<template>
  <div style="height: 100%; overflow: hidden">
      <el-tabs v-model="TabSheet" @tab-click="ResultTabClick" style="height: 100%" type="border-card" ref="tabs" class="Tabundefined RMTab ResultGerm" v-if="ShowSheet || this.Options.showreportview == '1'">
          <el-tab-pane label="涂片、培养、鉴定结果" name="1" style="height: 100%">
              <rm-layout-top splitcolor="#F8F8FF" :splitwidth="3" :fixsize="fixtop" ref="layouttop">
                  <template v-slot:fix>
                      <div :style="Options.doubleresultcol > 0 ? 'width:50%;float:left;height:100%' : 'height:100%'">
                          <vxe-table :data.sync="tableDataResult" @current-change="currentResultChangeEvent" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'M')" @edit-actived="ResultActive" @edit-closed="ResultClose" @cell-click="ResultCellClick" :cell-class-name="ColumnClassName" :height="h" highlight-current-row ref="xTableResult" resizable border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :show-xscroll="xscrollflag" :loading="loadingResult" size="mini" :width="w" config-record-key="Germ" class="ResultTable">
                              <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'" align="center"></vxe-table-column>
                              <vxe-table-column :field="item.field" :title="item.title" :width="item.width" v-for="item in tableResultColumn" v-bind:key="item.field" :align="item.field == 'result_str' && Options.resultstralignmentright > 0 ? 'right' : 'left'" :edit-render="{ name: 'input', autoselect: true }" header-align="center">
                                  <template v-slot="{ row }" v-if="item.field == 'alertflag' || item.field == 'redo_flag' || item.field == 'modify_flag'">
                                      <div v-if="item.field == 'alertflag' && row.alertflag > 0" v-bind:style="{ background: Options.alertflagcolor ? Options.alertflagcolor : 'red', height: '25px' }"></div>
                                      <div v-else-if="item.field == 'redo_flag' && row.redo_flag > 0" v-bind:style="{ background: row.redo_flag == '2' ? 'rgb(00, 255, 00)' : Options.redoflagcolor ? Options.redoflagcolor : 'yellow', height: '25px' }"></div>
                                      <div v-else-if="item.field == 'modify_flag' && row.modify_flag > 0" v-bind:style="{ background: Options.modifyflagcolor ? Options.modifyflagcolor : '#FFFFFF', height: '25px' }"></div>
                                      <div v-else></div>
                                  </template>
                                  <template v-slot="{ row }" v-else-if="item.field == 'rpt_itemname'">
                                      <div :style="ResultClassName(row)">
                                          <span>{{ row.rpt_itemname }}</span>
                                      </div>
                                  </template>
                                  <template v-slot="{ row }" v-else-if="item.field == 'result_str'">
                                      <div :style="ResultClass(row)">
                                          <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                          <span v-else>{{ row.result_str }}</span>
                                      </div>
                                  </template>

                                  <!-- <template v-slot="{ row,rowIndex }" v-else-if="item.field=='result4'">
                                      <el-select v-if="editflag" v-model="row.result4" @keyup.enter.native="ResultAddAsync(row,rowIndex)" @keyup.down.native="ResultMove(row,1,rowIndex,'result4')" @keyup.up.native="ResultMove(row,0,rowIndex,'result4')" style="width:100%;height:20px" placeholder="" :autofocus="true" clearable>
                                          <el-option :key="item.rescode" :value="item.rescode.toUpperCase()" :label="item.resname" v-for="item in Options.resdict"></el-option>
                                      </el-select>
                                      <span v-else>{{row.result4}}</span>
                                  </template> -->
                                  <template v-slot:edit="{ row, rowIndex }" v-if="item.field == 'rpt_itemname'">
                                      <el-input
                                          v-if="editflag"
                                          @keyup.space.native="
                                              (dialogRptVisible = true),
                                                  (tempRptItem = row),
                                                  $nextTick(() => {
                                                      $refs.rptdialog.$refs.qcodeinput.focus();
                                                  })
                                          "
                                          @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result_str')"
                                          @keyup.down.native="ResultMove(row, 1, rowIndex, 'rpt_itemname')"
                                          @keyup.up.native="ResultMove(row, 0, rowIndex, 'rpt_itemname')"
                                          @change="rptitemInput(row)"
                                          v-model="row.rpt_itemname"
                                          style="width: 100%; height: 20px"
                                          :autofocus="true"
                                          ref="rptitemname"
                                      ></el-input>
                                      <div :style="ResultClassName(row)" v-else>
                                          <span>{{ row.rpt_itemname }}</span>
                                      </div>
                                  </template>
                                  <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result_str'">
                                      <!-- <el-input v-if="editflag" v-model="row.result_str" @keyup.enter.native="$refs.xTableResult.setActiveCell(row,'result4')" @keyup.down.native="ResultMove(row,1,rowIndex,'result_str')" @keyup.up.native="ResultMove(row,0,rowIndex,'result_str')" style="width:100%;height:20px"></el-input> -->
                                      <!-- <el-autocomplete v-if="editflag" :popper-append-to-body="false" v-model="row.result_str" :fetch-suggestions="querySearch" placeholder="" @select="selectchange($event,row)" @keyup.enter.native="$refs.xTableResult.setActiveCell(row,'result4')" popper-class="mini-select" @keyup.down.native="ResultMove(row,1,rowIndex,'result_str')" @keyup.up.native="ResultMove(row,0,rowIndex,'result_str')" style="width:100%;height:20px">
                                          <template slot-scope="{ item }">
                                              <div class="name">{{ item.textvalue }}</div>
                                          </template>
                                      </el-autocomplete> -->
                                      <el-input v-model="row.result_str" style="width: 100%;18px" ref="rinput" @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result4')" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result_str')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result_str')" @dblclick.native="ResultDblClick" v-if="editflag">
                                          <i :class="iconclass" slot="suffix" @click="handleIconClick" v-show="tableDataResultAll.length > 0"></i>
                                      </el-input>
                                      <div ref="selectDialog" v-if="editflag" class="reqitem-dialog" v-show="textvalueshow" style="width: 240px">
                                          <div class="reqitem-select">
                                              <vxe-table :data.sync="tableDataResultAll" max-height="250px" stripe resizable header-align="center" show-header-overflow highlight-hover-row :keyboard-config="keyConfig" show-overflow size="mini" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" @cell-click="ResultTextClick($event, row)" class="ResultTxtTable">
                                                  <!-- <vxe-table-column v-for="item in allReqsheetTable" :key="item.id" :field="item.data" :title="item.label" :width="item.width" :align="item.align" show-overflow-tooltip></vxe-table-column> -->
                                                  <vxe-table-column field="textvalue" title="文字结果" width="160px" align="left" header-align="center" show-overflow-tooltip>
                                                      <template v-slot="{ row }">
                                                          <div :style="ResultClass(row)">
                                                              <span>{{ row.textvalue }}</span>
                                                          </div>
                                                      </template>
                                                  </vxe-table-column>
                                                  <vxe-table-column field="result_flag" title="结果标志" width="80px" align="center" show-overflow-tooltip>
                                                      <template v-slot="{ row }">
                                                          <span>{{ ReusltflagName(row.result_flag) }}</span>
                                                      </template>
                                                  </vxe-table-column>
                                                  <vxe-table-column field="redoflag" title="复查标志" width="60px" align="center" show-overflow-tooltip></vxe-table-column>
                                                  <vxe-table-column field="inputcode" title="输入码" width="80px" align="center" show-overflow-tooltip></vxe-table-column>
                                                  <vxe-table-column field="seq" title="序号" width="40px" align="center" show-overflow-tooltip></vxe-table-column>
                                                  <vxe-table-column field="containtext" title="录入码" width="100px" align="center" show-overflow-tooltip></vxe-table-column>
                                                  <!-- <vxe-table-column field="col_name" title="字段名称" width="80"></vxe-table-column> -->
                                              </vxe-table>
                                          </div>
                                      </div>
                                      <div :style="ResultClass(row)" v-else>
                                          <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                          <span v-else>{{ row.result_str }}</span>
                                      </div>
                                  </template>

                                  <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result1'">
                                      <el-input
                                          v-if="editflag"
                                          @keyup.space.native="
                                              (dialogGermCountVisible = true),
                                                  (tempRptItem = row),
                                                  $nextTick(() => {
                                                      $refs.germcountdialog.$refs.qcodeinput.focus();
                                                  })
                                          "
                                          @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result4')"
                                          @keyup.down.native="ResultMove(row, 1, rowIndex, 'result1')"
                                          @keyup.up.native="ResultMove(row, 0, rowIndex, 'result1')"
                                          v-model="row.result1"
                                          style="width: 100%; height: 20px"
                                          :autofocus="true"
                                      ></el-input>
                                      <span v-else>{{ row.result1 }}</span>
                                  </template>

                                  <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result4'">
                                      <!-- <el-select v-if="editflag" v-model="row.result4" @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result4')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result4')" style="width: 100%; height: 20px" placeholder="" :autofocus="true" clearable>
                                          <el-option :key="item.rescode" :value="item.rescode.toUpperCase()" :label="item.resname" v-for="item in Options.resdict"></el-option>
                                      </el-select> -->
                                      <el-select v-if="editflag" v-model="row.result4" @change="resistrulesChange($event, row)" @dblclick.native="popMultipleChk(row.result4,'result4',resdatadictList,'耐药机制选择', 1)"  @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result4')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result4')" clearable style="width: 100%; height: 20px" :autofocus="true">
                                          <el-option v-for="(item,index) in resdatadictList" :value="item.data" :label="item.display" :key="index">
                                              <span style="float: left">{{ item.display }}</span>
                                              <span style="float: right; color: #8492a6;">{{ item.data }}</span>
                                          </el-option>
                                      </el-select>
                                      <span v-else>{{ row.result4 }}</span>
                                  </template>

                                  <template v-slot:edit="{ row }" v-else>
                                      <span>{{ row[item.field] }}</span>
                                  </template>
                              </vxe-table-column>
                          </vxe-table>
                      </div>
                      <div style="width: 49%; float: left; height: 100%" v-if="Options.doubleresultcol > 0">
                          <vxe-table :data.sync="tableDataResult" @current-change="currentResultChangeEvent" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'M')" @edit-actived="ResultActive" @edit-closed="ResultClose" @cell-click="ResultCellClick" :cell-class-name="ColumnClassName" :height="h" highlight-current-row highlight-hover-row ref="xTableResult" resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingResult" size="mini" stripe :width="w">
                              <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'" align="center"></vxe-table-column>
                              <vxe-table-column :field="item.field" :title="item.title" :width="item.width" v-for="item in tableResultColumn" v-bind:key="item.field" :align="item.field == 'result_str' && Options.resultstralignmentright > 0 ? 'right' : 'left'" :edit-render="{ name: 'input', autoselect: true }" header-align="center">
                                  <template v-slot="{ row }" v-if="item.field == 'alertflag' || item.field == 'redo_flag' || item.field == 'modify_flag'">
                                      <div v-if="item.field == 'alertflag' && row.alertflag > 0" v-bind:style="{ background: Options.alertflagcolor ? Options.alertflagcolor : 'red', height: '25px' }"></div>
                                      <div v-else-if="item.field == 'redo_flag' && row.redo_flag > 0" v-bind:style="{ background: row.redo_flag == '2' ? 'rgb(00, 255, 00)' : Options.redoflagcolor ? Options.redoflagcolor : 'yellow', height: '25px' }"></div>
                                      <div v-else-if="item.field == 'modify_flag' && row.modify_flag > 0" v-bind:style="{ background: Options.modifyflagcolor ? Options.modifyflagcolor : '#FFFFFF', height: '25px' }"></div>
                                      <div v-else></div>
                                  </template>
                                  <template v-slot="{ row }" v-else-if="item.field == 'result_str'">
                                      <div :style="ResultClass(row)">
                                          <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                          <span v-else>{{ row.result_str }}</span>
                                      </div>
                                  </template>
                                  <template v-slot:edit="{ row, rowIndex }" v-if="item.field == 'rpt_itemname'">
                                      <el-input
                                          v-if="editflag"
                                          @keyup.space.native="
                                              (dialogRptVisible = true),
                                                  (tempRptItem = row),
                                                  $nextTick(() => {
                                                      $refs.rptdialog.$refs.qcodeinput.focus();
                                                  })
                                          "
                                          @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result_str')"
                                          @keyup.down.native="ResultMove(row, 1, rowIndex, 'rpt_itemname')"
                                          @keyup.up.native="ResultMove(row, 0, rowIndex, 'rpt_itemname')"
                                          @change="rptitemInput(row)"
                                          v-model="row.rpt_itemname"
                                          style="width: 100%; height: 20px"
                                          :autofocus="true"
                                          ref="rptitemname"
                                      ></el-input>
                                      <span v-else>{{ row.rpt_itemname }}</span>
                                  </template>
                                  <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result_str'">
                                      <el-input v-if="editflag" v-model="row.result_str" @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result_str')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result_str')" style="width: 100%; height: 20px"></el-input>
                                      <span v-else>{{ row.result_str }}</span>
                                  </template>
                                  <template v-slot:edit="{ row }" v-else>
                                      <span>{{ row[item.field] }}</span>
                                  </template>
                              </vxe-table-column>
                          </vxe-table>
                      </div>
                  </template>
                  <div class="bottom-table" style="height: 100%; margin-top: 5px">
                      <el-tabs v-model="tabvalue" @tab-click="MedTabClick" style="height: 100%" type="border-card" ref="tabs" class="Tabundefined RMTab ResultGerm">
                          <el-tab-pane label="药敏" name="1" class="Listclass" style="height: 100%">
                              <vxe-table :data.sync="tableDataMed" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" @edit-actived="ResultActive" @edit-closed="ResultClose" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'S')" :cell-class-name="ColumnGermClassName" height="auto" highlight-current-row highlight-hover-row ref="xTableMed" resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingMed" size="mini" width="600px" config-record-key="Med">
                                  <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'"></vxe-table-column>
                                  <vxe-table-column field="medname" title="抗生素" width="130px" :edit-render="{ name: 'input', autoselect: true }">
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <el-input
                                              v-if="editflag"
                                              @keyup.space.native="
                                                  (dialogMedVisible = true),
                                                      (tempMedItem = row),
                                                      $nextTick(() => {
                                                          $refs.meddialog.$refs.qcodeinput.focus();
                                                      })
                                              "
                                              @dblclick.native="
                                                  (dialogMedVisible = true),
                                                      (tempMedItem = row),
                                                      $nextTick(() => {
                                                          $refs.meddialog.$refs.qcodeinput.focus();
                                                      })
                                              "
                                              @keyup.enter.native="$refs.xTableMed.setActiveCell(row, 'rad')"
                                              @keyup.down.native="MedMove(row, 1, rowIndex, 'medname')"
                                              @keyup.up.native="MedMove(row, 0, rowIndex, 'medname')"
                                              @change="medInput(row)"
                                              v-model="row.medname"
                                              style="width: 100%; height: 20px"
                                          ></el-input>
                                          <span v-else>{{ row.medname }}</span>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="rad" title="Rad" width="40px" :edit-render="{ name: 'input', autoselect: true }">
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <el-input v-if="editflag &&( ((!Options.etestmethodmodifymic || Options.etestmethodmodifymic!='1' ) && row.medmethod != 'MIC') || (Options.etestmethodmodifymic && Options.etestmethodmodifymic=='1' && row.medmethod != 'MIC' && row.medmethod != 'Etest') )" @keyup.enter.native="AddRowGerm(row, rowIndex, 'rad')" v-model="row.rad" @change="CalcGerm($event, 'rad', row, rowIndex)" style="width: 100%; height: 20px"></el-input>
                                          <span v-else>{{ row.rad }}</span>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="mic" title="Mic" width="40px" :edit-render="{ name: 'input', autoselect: true }">
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <el-input v-if="editflag &&( ((!Options.etestmethodmodifymic || Options.etestmethodmodifymic!='1' ) && row.medmethod != 'KB' && row.medmethod != 'Etest') || (Options.etestmethodmodifymic && Options.etestmethodmodifymic=='1' && row.medmethod!= 'KB')  )" @keyup.enter.native="AddRowGerm(row, rowIndex, 'mic')" v-model="row.mic" @change="CalcGerm($event, 'mic', row, rowIndex)" style="width: 100%; height: 20px"></el-input>
                                          <span v-else>{{ row.mic }}</span>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="medresult" title="药敏结果" width="70px" :edit-render="{ name: 'input', autoselect: true }" align="left" header-align="center">
                                      <template v-slot="{ row }">
                                          <div :style="ResultClassGerm(row)">
                                              <span>{{ row.medresult }}</span>
                                          </div>
                                      </template>
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <span v-if="!editflag">{{ row.medresult }}</span>
                                          <el-input v-model="row.medresult" style="height: 20px" @change="CalcGerm($event, 'medresult', row, rowIndex)" v-else></el-input>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="result_flag" title="结果标志" width="220px" show-overflow="ellipsis">
                                      <template v-slot:header>
                                          <el-button @click="SetResultflag('R')">R</el-button>
                                          <div style="margin-left: 10px; margin-right: 10px; display: inline">结果标志</div>
                                          <el-button @click="SetResultflag('S')">S</el-button>
                                      </template>
                                      <template v-slot="{ row }">
                                          <el-radio-group v-model="row.result_flag" @change="rflagchange($event, row)" :disabled="!editflag">
                                              <el-radio label="R">R</el-radio>
                                              <el-radio label="I">I</el-radio>
                                              <el-radio label="S">S</el-radio>
                                              <el-radio label="N">N</el-radio>
                                              <el-radio label="SDD">SDD</el-radio>
                                              <el-radio label="ns">ns</el-radio>
                                              <el-radio label="WT">WT</el-radio>
                                              <el-radio label="NWT">NWT</el-radio>
                                          </el-radio-group>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="result6" title="参考范围" width="100px"></vxe-table-column>
                                  <vxe-table-column field="medgroup" title="分组" width="60px"></vxe-table-column>
                                  <vxe-table-column field="medmethod" title="试验方法" width="100px" :edit-render="{ name: 'select', options: $opt.appmethodOption, events: { change: medmethodChange } }"> </vxe-table-column>
                                  <vxe-table-column field="redo_flag" title="复查标记" :edit-render="{name: 'input'}" width="100px" >
                                      <template v-slot="{ row }">
                                          <div :style="RedoResultClassGerm(row)">
                                              <span>{{RedoMedResult(row.redo_flag,row)}}</span>
                                          </div>
                                      </template>
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <el-select v-model="row.redo_flag" placeholder="请选择"  @change="redoflagchange($event,row)" :popper-append-to-body="true" popper-class="mini-select" style="width: 100%;">
                                              <el-option v-for="item in medRedoResultList" :key="rowIndex + item.value" :label="item.name" :value="item.value"></el-option>
                                          </el-select>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="guidelines" title="使用标准" width="100px"></vxe-table-column>
                                  <vxe-table-column field="medconc" title="药物浓度" width="100px" :edit-render="{ name: 'input', autoselect: true }">
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <span v-if="!editflag">{{ row.medconc }}</span>
                                          <el-input v-model="row.medconc" style="height: 20px" @change="CalcGerm($event, 'medconc', row, rowIndex)" v-else></el-input>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="expertresult" title="专家值" width="100px" :edit-render="{ name: 'input', autoselect: true }">
                                      <template v-slot:edit="{ row, rowIndex }">
                                          <span v-if="!editflag">{{ row.expertresult }}</span>
                                          <el-input v-model="row.expertresult" style="height: 20px" @change="CalcGerm($event, 'expertresult', row, rowIndex)" v-else></el-input>
                                      </template>
                                  </vxe-table-column>
                                  <template v-slot:fix>
                                      <div style="font-size: 12px; padding: 5px; background-color: #fff; bottom: 10px">
                                          <div class="bottom-table-button">
                                              <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupAdd()">新增组合</el-button>
                                              <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupDelAll()">删除全部</el-button>
                                              <el-button style="background-color: #e6e6e6; color: black" @click="MedAdd()">新增单个</el-button>
                                              <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupDel()">删除单个</el-button>
                                          </div>
                                      </div>
                                  </template>
                              </vxe-table>
                          </el-tab-pane>
                          <el-tab-pane label="评语" name="2" class="Listclass" style="height: 100%">
                              <el-input type="textarea" v-model="tempRptItem.result_txt" @change="commentChange" :rows="commentnum" @dblclick.native="editflag ? (dialogCommentVisible = true) : ''" @focus="QueryComment" :readonly="!editflag"></el-input>
                          </el-tab-pane>
                      </el-tabs>
                  </div>
              </rm-layout-top>
          </el-tab-pane>
          <el-tab-pane v-if="ShowSheet" label="记录单" name="2" style="height: 100%">
              <div style="text-align: center; padding-bottom: 20px">
                  <!-- <div style="width:30%;float:left">
                      <el-button>打印补费通知单</el-button>
                  </div> -->
                  <div style="width: 100%; float: left">
                      <el-button @click="printGermSheet" type="310">打印流程记录单</el-button>
                  </div>
                  <!-- <div style="width:30%;float:left">
                      <el-button>批打流程单</el-button>
                  </div> -->
              </div>
              <div style="padding-top: 20px; font-size: 12px">
                  <div style="float: left">
                      <div style="width: 50px; float: left; text-align: right; padding-top: 4px">接种时间</div>
                      <el-input v-model="Sheetdate" style="width: 135px; padding-left: 3px" readonly></el-input>
                  </div>
                  <div style="width: 30%; float: left">接种人<el-input v-model="Sheetusername" style="width: calc(100% - 60px)" readonly></el-input></div>
                  <div style="width: 30%; float: left">接收人<el-input v-model="Recieveusername" style="width: calc(100% - 60px)" readonly></el-input></div>
              </div>
              <div>
                  <table style="width: 100%; float: left; font-size: 12px" class="SheetTable">
                      <tr>
                          <td>培养基</td>
                          <td>
                              <el-input v-model="Medium" style="width: calc(100% - 60px)" @dblclick.native="ShowGroup" @change="SheetChange" :readonly="!editflag"></el-input>
                              <el-button @click="ShowGroup">组合</el-button>
                          </td>
                      </tr>
                      <tr>
                          <td>培养条件</td>
                          <td>
                              <el-input v-model="Conditions" type="textarea" rows="2" style="width: 100%" @change="SheetChange" :readonly="!editflag"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td>涂片结果</td>
                          <td>
                              <el-input v-model="Smear" type="textarea" rows="2" style="width: 100%" @change="SheetChange" :readonly="!editflag"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td>染色结果</td>
                          <td>
                              <el-input v-model="Dyeing" type="textarea" rows="2" style="width: 100%" @change="SheetChange" :readonly="!editflag"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td>菌落特征</td>
                          <td>
                              <el-input v-model="ColonyResult" type="textarea" rows="2" style="width: 100%" @change="SheetChange" :readonly="!editflag"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td>菌落计数</td>
                          <td>
                              <el-input v-model="ColonyNum" type="textarea" rows="2" style="width: 100%" @change="SheetChange" :readonly="!editflag"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td>其他结果</td>
                          <td>
                              <el-input v-model="OtherResult" type="textarea" rows="2" style="width: 100%" @change="SheetChange"></el-input>
                          </td>
                      </tr>
                  </table>
              </div>
          </el-tab-pane>
          <el-tab-pane v-if="Options.showreportview == '1'" label="报告预览" name="3" style="height:100%;">
              <div style="width:100%;height:100%;" id="reportviewid">
                  <div v-html="reportviewstr"></div>
              </div>
          </el-tab-pane>
      </el-tabs>
      <rm-layout-top splitcolor="#F8F8FF" :splitwidth="3" :fixsize="fixtop" ref="layouttop" v-else>
          <template v-slot:fix>
              <div :style="Options.doubleresultcol > 0 ? 'width:50%;float:left;height:100%' : 'height:100%'">
                  <vxe-table :data.sync="tableDataResult" @current-change="currentResultChangeEvent" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'M')" @edit-actived="ResultActive" @edit-closed="ResultClose" :cell-class-name="ColumnClassName" :height="h" highlight-current-row ref="xTableResult" resizable border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :show-xscroll="xscrollflag" :loading="loadingResult" size="mini" :width="w" config-record-key="Germ" class="ResultTable">
                      <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'" align="center"></vxe-table-column>
                      <vxe-table-column :field="item.field" :title="item.title" :width="item.width" v-for="item in tableResultColumn" v-bind:key="item.field" :align="item.field == 'result_str' && Options.resultstralignmentright > 0 ? 'right' : 'left'" :edit-render="{ name: 'input', autoselect: true }" header-align="center">
                          <template v-slot="{ row }" v-if="item.field == 'alertflag' || item.field == 'redo_flag' || item.field == 'modify_flag'">
                              <div v-if="item.field == 'alertflag' && row.alertflag > 0" v-bind:style="{ background: Options.alertflagcolor ? Options.alertflagcolor : 'red', height: '25px' }"></div>
                              <div v-else-if="item.field == 'redo_flag' && row.redo_flag > 0" v-bind:style="{ background: row.redo_flag == '2' ? 'rgb(00, 255, 00)' : Options.redoflagcolor ? Options.redoflagcolor : 'yellow', height: '25px' }"></div>
                              <div v-else-if="item.field == 'modify_flag' && row.modify_flag > 0" v-bind:style="{ background: Options.modifyflagcolor ? Options.modifyflagcolor : '#FFFFFF', height: '25px' }"></div>
                              <div v-else></div>
                          </template>
                          <template v-slot="{ row }" v-else-if="item.field == 'rpt_itemname'">
                              <div :style="ResultClassName(row)">
                                  <span>{{ row.rpt_itemname }}</span>
                              </div>
                          </template>
                          <template v-slot="{ row }" v-else-if="item.field == 'result_str'">
                              <div :style="ResultClass(row)">
                                  <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                  <span v-else>{{ row.result_str }}</span>
                              </div>
                          </template>

                          <!-- <template v-slot="{ row,rowIndex }" v-else-if="item.field=='result4'">
                                      <el-select v-if="editflag" v-model="row.result4" @keyup.enter.native="ResultAddAsync(row,rowIndex)" @keyup.down.native="ResultMove(row,1,rowIndex,'result4')" @keyup.up.native="ResultMove(row,0,rowIndex,'result4')" style="width:100%;height:20px" placeholder="" :autofocus="true" clearable>
                                          <el-option :key="item.rescode" :value="item.rescode.toUpperCase()" :label="item.resname" v-for="item in Options.resdict"></el-option>
                                      </el-select>
                                      <span v-else>{{row.result4}}</span>
                                  </template> -->
                          <template v-slot:edit="{ row, rowIndex }" v-if="item.field == 'rpt_itemname'">
                              <el-input
                                  v-if="editflag"
                                  @keyup.space.native="
                                      (dialogRptVisible = true),
                                          (tempRptItem = row),
                                          $nextTick(() => {
                                              $refs.rptdialog.$refs.qcodeinput.focus();
                                          })
                                  "
                                  @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result_str')"
                                  @keyup.down.native="ResultMove(row, 1, rowIndex, 'rpt_itemname')"
                                  @keyup.up.native="ResultMove(row, 0, rowIndex, 'rpt_itemname')"
                                  @change="rptitemInput(row)"
                                  v-model="row.rpt_itemname"
                                  style="width: 100%; height: 20px"
                                  :autofocus="true"
                                  ref="rptitemname"
                              ></el-input>
                              <div :style="ResultClassName(row)" v-else>
                                  <span>{{ row.rpt_itemname }}</span>
                              </div>
                          </template>
                          <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result_str'">
                              <!-- <el-input v-if="editflag" v-model="row.result_str" @keyup.enter.native="$refs.xTableResult.setActiveCell(row,'result4')" @keyup.down.native="ResultMove(row,1,rowIndex,'result_str')" @keyup.up.native="ResultMove(row,0,rowIndex,'result_str')" style="width:100%;height:20px"></el-input> -->
                              <!-- <el-autocomplete v-if="editflag" :popper-append-to-body="false" v-model="row.result_str" :fetch-suggestions="querySearch" placeholder="" @select="selectchange($event,row)" @keyup.enter.native="$refs.xTableResult.setActiveCell(row,'result4')" popper-class="mini-select" @keyup.down.native="ResultMove(row,1,rowIndex,'result_str')" @keyup.up.native="ResultMove(row,0,rowIndex,'result_str')" style="width:100%;height:20px">
                                          <template slot-scope="{ item }">
                                              <div class="name">{{ item.textvalue }}</div>
                                          </template>
                                      </el-autocomplete> -->
                              <el-input v-model="row.result_str" style="width: 100%;18px" ref="rinput" @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result4')" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result_str')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result_str')" @dblclick.native="ResultDblClick" v-if="editflag">
                                  <i :class="iconclass" slot="suffix" @click="handleIconClick" v-show="tableDataResultAll.length > 0"></i>
                              </el-input>
                              <div ref="selectDialog" v-if="editflag" class="reqitem-dialog" v-show="textvalueshow" style="width: 240px">
                                  <div class="reqitem-select">
                                      <vxe-table :data.sync="tableDataResultAll" max-height="250px" stripe resizable header-align="center" show-header-overflow highlight-hover-row :keyboard-config="keyConfig" show-overflow size="mini" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" @cell-click="ResultTextClick($event, row)" class="ResultTxtTable">
                                          <!-- <vxe-table-column v-for="item in allReqsheetTable" :key="item.id" :field="item.data" :title="item.label" :width="item.width" :align="item.align" show-overflow-tooltip></vxe-table-column> -->
                                          <vxe-table-column field="textvalue" title="文字结果" width="160px" align="left" header-align="center" show-overflow-tooltip>
                                              <template v-slot="{ row }">
                                                  <div :style="ResultClass(row)">
                                                      <span>{{ row.textvalue }}</span>
                                                  </div>
                                              </template>
                                          </vxe-table-column>
                                          <vxe-table-column field="result_flag" title="结果标志" width="80px" align="center" show-overflow-tooltip>
                                              <template v-slot="{ row }">
                                                  <span>{{ ReusltflagName(row.result_flag) }}</span>
                                              </template>
                                          </vxe-table-column>
                                          <vxe-table-column field="redoflag" title="复查标志" width="60px" align="center" show-overflow-tooltip></vxe-table-column>
                                          <vxe-table-column field="inputcode" title="输入码" width="80px" align="center" show-overflow-tooltip></vxe-table-column>
                                          <vxe-table-column field="seq" title="序号" width="40px" align="center" show-overflow-tooltip></vxe-table-column>
                                          <vxe-table-column field="containtext" title="录入码" width="100px" align="center" show-overflow-tooltip></vxe-table-column>
                                          <!-- <vxe-table-column field="col_name" title="字段名称" width="80"></vxe-table-column> -->
                                      </vxe-table>
                                  </div>
                              </div>
                              <div :style="ResultClass(row)" v-else>
                                  <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                  <span v-else>{{ row.result_str }}</span>
                              </div>
                          </template>

                          <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result1'">
                              <el-input
                                  v-if="editflag"
                                  @keyup.space.native="
                                      (dialogGermCountVisible = true),
                                          (tempRptItem = row),
                                          $nextTick(() => {
                                              $refs.germcountdialog.$refs.qcodeinput.focus();
                                          })
                                  "
                                  @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result4')"
                                  @keyup.down.native="ResultMove(row, 1, rowIndex, 'result1')"
                                  @keyup.up.native="ResultMove(row, 0, rowIndex, 'result1')"
                                  v-model="row.result1"
                                  style="width: 100%; height: 20px"
                                  :autofocus="true"
                              ></el-input>
                              <span v-else>{{ row.result1 }}</span>
                          </template>
                          <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result4'">
                              <!-- <el-select v-if="editflag" v-model="row.result4" @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result4')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result4')" style="width: 100%; height: 20px" placeholder="" :autofocus="true" clearable>
                                  <el-option :key="item.rescode" :value="item.rescode.toUpperCase()" :label="item.resname" v-for="item in Options.resdict"></el-option>
                              </el-select> -->
                              <el-select v-if="editflag" v-model="row.result4" @change="resistrulesChange($event, row)" @dblclick.native="popMultipleChk(row.result4,'result4',resdatadictList,'耐药机制选择', 1)"  @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result4')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result4')" clearable style="width: 100%; height: 20px" :autofocus="true">
                                  <el-option v-for="(item,index) in resdatadictList" :value="item.data" :label="item.display" :key="index">
                                      <span style="float: left">{{ item.display }}</span>
                                      <span style="float: right; color: #8492a6;">{{ item.data }}</span>
                                  </el-option>
                              </el-select>
                              <span v-else>{{ row.result4 }}</span>
                          </template>
                          <template v-slot:edit="{ row }" v-else>
                              <span>{{ row[item.field] }}</span>
                          </template>
                      </vxe-table-column>
                  </vxe-table>
              </div>
              <div style="width: 49%; float: left; height: 100%" v-if="Options.doubleresultcol > 0">
                  <vxe-table :data.sync="tableDataResult" @current-change="currentResultChangeEvent" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'M')" @edit-actived="ResultActive" @edit-closed="ResultClose" :cell-class-name="ColumnClassName" :height="h" highlight-current-row highlight-hover-row ref="xTableResult" resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingResult" size="mini" stripe :width="w">
                      <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'" align="center"></vxe-table-column>
                      <vxe-table-column :field="item.field" :title="item.title" :width="item.width" v-for="item in tableResultColumn" v-bind:key="item.field" :align="item.field == 'result_str' && Options.resultstralignmentright > 0 ? 'right' : 'left'" :edit-render="{ name: 'input', autoselect: true }" header-align="center">
                          <template v-slot="{ row }" v-if="item.field == 'alertflag' || item.field == 'redo_flag' || item.field == 'modify_flag'">
                              <div v-if="item.field == 'alertflag' && row.alertflag > 0" v-bind:style="{ background: Options.alertflagcolor ? Options.alertflagcolor : 'red', height: '25px' }"></div>
                              <div v-else-if="item.field == 'redo_flag' && row.redo_flag > 0" v-bind:style="{ background: row.redo_flag == '2' ? 'rgb(00, 255, 00)' : Options.redoflagcolor ? Options.redoflagcolor : 'yellow', height: '25px' }"></div>
                              <div v-else-if="item.field == 'modify_flag' && row.modify_flag > 0" v-bind:style="{ background: Options.modifyflagcolor ? Options.modifyflagcolor : '#FFFFFF', height: '25px' }"></div>
                              <div v-else></div>
                          </template>
                          <template v-slot="{ row }" v-else-if="item.field == 'result_str'">
                              <div :style="ResultClass(row)">
                                  <span v-if="Options.resultstrbold == '1'" style="font-weight: bold">{{ row.result_str }}</span>
                                  <span v-else>{{ row.result_str }}</span>
                              </div>
                          </template>
                          <template v-slot:edit="{ row, rowIndex }" v-if="item.field == 'rpt_itemname'">
                              <el-input
                                  v-if="editflag"
                                  @keyup.space.native="
                                      (dialogRptVisible = true),
                                          (tempRptItem = row),
                                          $nextTick(() => {
                                              $refs.rptdialog.$refs.qcodeinput.focus();
                                          })
                                  "
                                  @keyup.enter.native="$refs.xTableResult.setActiveCell(row, 'result_str')"
                                  @keyup.down.native="ResultMove(row, 1, rowIndex, 'rpt_itemname')"
                                  @keyup.up.native="ResultMove(row, 0, rowIndex, 'rpt_itemname')"
                                  @change="rptitemInput(row)"
                                  v-model="row.rpt_itemname"
                                  style="width: 100%; height: 20px"
                                  :autofocus="true"
                                  ref="rptitemname"
                              ></el-input>
                              <span v-else>{{ row.rpt_itemname }}</span>
                          </template>
                          <template v-slot:edit="{ row, rowIndex }" v-else-if="item.field == 'result_str'">
                              <el-input v-if="editflag" v-model="row.result_str" @keyup.enter.native="ResultAddAsync(row, rowIndex)" @keyup.down.native="ResultMove(row, 1, rowIndex, 'result_str')" @keyup.up.native="ResultMove(row, 0, rowIndex, 'result_str')" style="width: 100%; height: 20px"></el-input>
                              <span v-else>{{ row.result_str }}</span>
                          </template>
                          <template v-slot:edit="{ row }" v-else>
                              <span>{{ row[item.field] }}</span>
                          </template>
                      </vxe-table-column>
                  </vxe-table>
              </div>
          </template>
          <div class="bottom-table" style="height: 100%; margin-top: 5px">
              <el-tabs v-model="tabvalue" @tab-click="MedTabClick" style="height: 100%" type="border-card" ref="tabs" class="Tabundefined RMTab ResultGerm">
                  <el-tab-pane label="药敏" name="1" class="Listclass" style="height: 100%">
                      <vxe-table :data.sync="tableDataMed" :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" @edit-actived="ResultActive" @edit-closed="ResultClose" :mouse-config="{ selected: true }" :select-config="selectConfig" @cell-dblclick="DblEvent($event,'S')" :cell-class-name="ColumnGermClassName" height="auto" highlight-current-row highlight-hover-row ref="xTableMed" resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingMed" size="mini" width="600px" config-record-key="Med">
                          <vxe-table-column type="index" width="30px" v-if="Options['input_hideresultno'] == '0'"></vxe-table-column>
                          <vxe-table-column field="medname" title="抗生素" width="130px" :edit-render="{ name: 'input', autoselect: true }">
                              <template v-slot:edit="{ row, rowIndex }">
                                  <el-input
                                      v-if="editflag"
                                      @keyup.space.native="
                                          (dialogMedVisible = true),
                                              (tempMedItem = row),
                                              $nextTick(() => {
                                                  $refs.meddialog.$refs.qcodeinput.focus();
                                              })
                                      "
                                      @dblclick.native="
                                          (dialogMedVisible = true),
                                              (tempMedItem = row),
                                              $nextTick(() => {
                                                  $refs.meddialog.$refs.qcodeinput.focus();
                                              })
                                      "
                                      @keyup.enter.native="$refs.xTableMed.setActiveCell(row, 'rad')"
                                      @keyup.down.native="MedMove(row, 1, rowIndex, 'medname')"
                                      @keyup.up.native="MedMove(row, 0, rowIndex, 'medname')"
                                      @change="medInput(row)"
                                      v-model="row.medname"
                                      style="width: 100%; height: 20px"
                                  ></el-input>
                                  <span v-else>{{ row.medname }}</span>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="rad" title="Rad" width="40px" :edit-render="{ name: 'input', autoselect: true }">
                              <template v-slot:edit="{ row, rowIndex }">
                                  <el-input v-if="editflag &&( ((!Options.etestmethodmodifymic || Options.etestmethodmodifymic!='1' ) && row.medmethod != 'MIC') || (Options.etestmethodmodifymic && Options.etestmethodmodifymic=='1' && row.medmethod != 'MIC' && row.medmethod != 'Etest') )" @keyup.enter.native="AddRowGerm(row, rowIndex, 'rad')" v-model="row.rad" @change="CalcGerm($event, 'rad', row, rowIndex)" style="width: 100%; height: 20px"></el-input>
                                  <span v-else>{{ row.rad }}</span>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="mic" title="Mic" width="40px" :edit-render="{ name: 'input', autoselect: true }">
                              <template v-slot:edit="{ row, rowIndex }">
                                  <el-input v-if="editflag &&( ((!Options.etestmethodmodifymic || Options.etestmethodmodifymic!='1' ) && row.medmethod != 'KB' && row.medmethod != 'Etest') || (Options.etestmethodmodifymic && Options.etestmethodmodifymic=='1' && row.medmethod!= 'KB')  )" @keyup.enter.native="AddRowGerm(row, rowIndex, 'mic')" v-model="row.mic" @change="CalcGerm($event, 'mic', row, rowIndex)" style="width: 100%; height: 20px"></el-input>
                                  <span v-else>{{ row.mic }}</span>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="medresult" title="药敏结果" width="70px" :edit-render="{ name: 'input', autoselect: true }" align="left" header-align="center">
                              <template v-slot="{ row }">
                                  <div :style="ResultClassGerm(row)">
                                      <span>{{ row.medresult }}</span>
                                  </div>
                              </template>
                              <template v-slot:edit="{ row, rowIndex }">
                                  <span v-if="!editflag">{{ row.medresult }}</span>
                                  <el-input v-model="row.medresult" style="height: 20px" @change="CalcGerm($event, 'medresult', row, rowIndex)" v-else></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="result_flag" title="结果标志" width="220px" show-overflow="ellipsis">
                              <template v-slot:header>
                                  <el-button @click="SetResultflag('R')">R</el-button>
                                  <div style="margin-left: 10px; margin-right: 10px; display: inline">结果标志</div>
                                  <el-button @click="SetResultflag('S')">S</el-button>
                              </template>
                              <template v-slot="{ row }">
                                  <el-radio-group v-model="row.result_flag" @change="rflagchange($event, row)" :disabled="!editflag">
                                      <el-radio label="R">R</el-radio>
                                      <el-radio label="I">I</el-radio>
                                      <el-radio label="S">S</el-radio>
                                      <el-radio label="N">N</el-radio>
                                      <el-radio label="SDD">SDD</el-radio>
                                      <el-radio label="ns">ns</el-radio>
                                      <el-radio label="WT">WT</el-radio>
                                      <el-radio label="NWT">NWT</el-radio>
                                  </el-radio-group>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="result6" title="参考范围" width="100px"></vxe-table-column>
                          <vxe-table-column field="medgroup" title="分组" width="60px"></vxe-table-column>
                          <vxe-table-column field="medmethod" title="试验方法" width="100px" :edit-render="{ name: 'select', options: $opt.appmethodOption, events: { change: medmethodChange } }"></vxe-table-column>
                          <vxe-table-column field="redo_flag" title="复查标记" :edit-render="{name: 'input'}" width="100px" >
                              <template v-slot="{ row }">
                                  <div :style="RedoResultClassGerm(row)">
                                      <span>{{RedoMedResult(row.redo_flag,row)}}</span>
                                  </div>
                              </template>
                              <template v-slot:edit="{ row, rowIndex }">
                                  <el-select v-model="row.redo_flag" placeholder="请选择"  @change="redoflagchange($event,row)" :popper-append-to-body="true" popper-class="mini-select" style="width: 100%;">
                                      <el-option v-for="item in medRedoResultList" :key="rowIndex + item.value" :label="item.name" :value="item.value"></el-option>
                                  </el-select>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="guidelines" title="使用标准" width="100px"></vxe-table-column>
                          <vxe-table-column field="medconc" title="药物浓度" width="100px" :edit-render="{ name: 'input', autoselect: true }">
                              <template v-slot:edit="{ row, rowIndex }">
                                  <span v-if="!editflag">{{ row.medconc }}</span>
                                  <el-input v-model="row.medconc" style="height: 20px" @change="CalcGerm($event, 'medconc', row, rowIndex)" v-else></el-input>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="expertresult" title="专家值" width="100px" :edit-render="{ name: 'input', autoselect: true }">
                              <template v-slot:edit="{ row, rowIndex }">
                                  <span v-if="!editflag">{{ row.expertresult }}</span>
                                  <el-input v-model="row.expertresult" style="height: 20px" @change="CalcGerm($event, 'expertresult', row, rowIndex)" v-else></el-input>
                              </template>
                          </vxe-table-column>
                          <template v-slot:fix>
                              <div style="font-size: 12px; padding: 5px; background-color: #fff; bottom: 10px">
                                  <div class="bottom-table-button">
                                      <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupAdd()">新增组合</el-button>
                                      <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupDelAll()">删除全部</el-button>
                                      <el-button style="background-color: #e6e6e6; color: black" @click="MedAdd()">新增单个</el-button>
                                      <el-button style="background-color: #e6e6e6; color: black" @click="MedGroupDel()">删除单个</el-button>
                                  </div>
                              </div>
                          </template>
                      </vxe-table>
                  </el-tab-pane>
                  <el-tab-pane label="评语" name="2" class="Listclass" style="height: 100%">
                      <el-input type="textarea" v-model="tempRptItem.result_txt" @change="commentChange" :rows="commentnum" @dblclick.native="editflag ? (dialogCommentVisible = true) : ''" @focus="QueryComment" :readonly="!editflag"></el-input>
                  </el-tab-pane>
              </el-tabs>
          </div>
      </rm-layout-top>
      <!-- <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="报告项目" :visible.sync="dialogRptVisible" @close="$refs.xTableResult.setActiveCell($refs.xTableResult.getCurrentRow(), 'rpt_itemname')">
          <rm-pop-rptitem prgno="LIS311" @cancel="dialogRptVisible=false,$refs.xTableResult.setActiveCell($refs.xTableResult.getCurrentRow(), 'rpt_itemname')" :isAllRpt="1" :rptunitid="rptunitid" :rptunitdisabled="true" :germmode="true" @selitem="addrptitem" ref="rptdialog"></rm-pop-rptitem>
      </el-dialog> -->

      <!--多选弹窗--->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogRptVisible" :destroy-on-close="true" title="报告项目" v-if="dialogRptVisible" @close="$refs.xTableResult.setActiveCell($refs.xTableResult.getCurrentRow(), 'rpt_itemname')">
          <rm-chkboxSelect2 prgno="LIS311" @cancel="(dialogRptVisible = false), $refs.xTableResult.setActiveCell($refs.xTableResult.getCurrentRow(), 'rpt_itemname')" :isAllRpt="1" :rptunitid="rptunitid" :rptunitdisabled="true" :germmode="true" :fitembyrptunit="Options.fitembyrptunit" @selitem="addrptitem" @selitems="SelectRptItems" ref="rptdialog"></rm-chkboxSelect2>
      </el-dialog>
      <!--多选弹窗--->
      <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true" >
          <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"></rm-SqlMultiple>
      </el-dialog>
      <!--报告项目结果选择开窗-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="报告项目常见结果选择" :visible.sync="dialogResultVisible" v-if="dialogResultVisible">
          <el-container style="border: 1px solid #eee; height: 600px">
              <el-main style="overflow: hidden; padding: 0 0">
                  <el-input @keyup.enter.native="ResultSearchkeydown" placeholder="快速检索" prefix-icon="el-icon-search" ref="qcodeinput" style="width: 300px" v-model="Resultqcode"></el-input>
                  <el-button @click="Resultok" icon="el-icon-circle-check" style="margin-left: 10px">确定</el-button>
                  <el-button @click="Resultcancel" icon="el-icon-circle-close">取消</el-button>
                  <div style="height: 564px">
                      <vxe-table :data="tableDataResultS" @cell-dblclick="ResultSelect" border height="564px" highlight-current-row highlight-hover-row resizable size="mini" stripe style="margin-top: 10px" ref="xTableResultAll">
                          <vxe-table-column field="textvalue" title="文字结果" width="200px"></vxe-table-column>
                          <vxe-table-column field="result_flag" title="结果标志" width="60px"></vxe-table-column>
                          <vxe-table-column field="redoflag" title="复查标志" width="60px"></vxe-table-column>
                          <vxe-table-column field="inputcode" title="快速输入码" width="80px"></vxe-table-column>
                          <vxe-table-column field="seq" title="序号" width="40px"></vxe-table-column>
                          <vxe-table-column field="containtext" title="录入码" width="80px"></vxe-table-column>
                          <!--<vxe-table-column :field="item.field" :key="item.field" :title="item.title" width="100px" v-for="item in tableColumnResultAll"></vxe-table-column>-->
                      </vxe-table>
                  </div>
              </el-main>
          </el-container>
      </el-dialog>

      <!--评语选择开窗-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogCommentVisible" title="评语选择" :destroy-on-close="true" top="5vh" width="700px">
          <div>
              <el-input type="textarea" :rows="6" v-model="tempRptItem.result_txt"></el-input>
          </div>
          <div>
              <table style="width: 100%; border-spacing: 0px; margin-top: 5px">
                  <tr>
                      <td>
                          快速查找
                          <el-input v-model="advicesearchtxt" @input="CommentSearch" placeholder="请输入要查找的信息" style="width: calc(100% - 60px)"></el-input>
                      </td>
                  </tr>
                  <tr>
                      <td style="width: 450px">
                          <vxe-table :data="tableDataComment" :select-config="selectConfig" :keyboard-config="keyConfig" @cell-click="AdviceClick" @cell-dblclick="AdvicedblClick" height="300px" highlight-current-row highlight-hover-row resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" size="mini" stripe width="400px">
                              <vxe-table-column field="germcommentcode" title="评语代码" width="100px"></vxe-table-column>
                              <vxe-table-column field="germcommentname" title="评语内容" width="160px"></vxe-table-column>
                              <vxe-table-column field="descriptions" title="描述" width="80px"></vxe-table-column>
                              <vxe-table-column field="germcommentid" title="评语ID" width="80px"></vxe-table-column>
                          </vxe-table>
                      </td>
                      <td>
                          <div style="margin-left: 15px">
                              <el-button style="display: block" @click="AdviceSubmit()">确 定</el-button>
                              <el-button style="display: block; margin-left: 0px; margin-top: 5px" @click="dialogCommentVisible = false">取 消</el-button>
                              <el-checkbox v-model="appendChangeRow" style="margin-top: 20px; display: block">追加时自动换行</el-checkbox>
                              <div style="margin-top: 20px">
                                  <span style="color: blue">说明:<br />单击为追加<br />双击为替换</span>
                              </div>
                          </div>
                      </td>
                  </tr>
              </table>
          </div>
      </el-dialog>

      <!--新增药敏组合弹窗-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择药敏组合" :visible.sync="dialogMedGroupVisible" v-if="dialogMedGroupVisible">
          <rm-pop-common @change="MedGroupChange" @cancel="dialogMedGroupVisible = false" :rptunitid="rptunitid" datatype="labmedgroup"></rm-pop-common>
      </el-dialog>
      <!--新增抗生素弹窗-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择抗生素" :visible.sync="dialogMedVisible" v-if="dialogMedVisible">
          <rm-pop-common @change="MedChange" @cancel="dialogMedVisible = false" datatype="labmed" ref="meddialog"></rm-pop-common>
      </el-dialog>
      <!--菌落计数弹窗-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择菌落计数" :visible.sync="dialogGermCountVisible">
          <rm-pop-common @change="GermCountChange" @cancel="dialogGermCountVisible = false" datatype="seccode" kindno="GERMCOUNTS" ref="germcountdialog"></rm-pop-common>
      </el-dialog>
      <!--培养基弹窗-->
      <el-dialog v-el-drag-dialog width="585px" top="10px" :append-to-body="true" :close-on-click-modal="false" title="培养基组合选择" ref="group" :visible.sync="groupVisible" v-if="groupVisible" :destroy-on-close="true">
          <div>
              <div>
                  <el-radio-group v-model="poppureflag" @change="pureflagChange">
                      <el-radio label="4">全部</el-radio>
                      <el-radio label="0">普通</el-radio>
                      <el-radio label="1">纯分</el-radio>
                      <el-radio label="2">转种</el-radio>
                  </el-radio-group>
              </div>
              <div class="pureflag-deal">
                  <el-input placeholder="请输入组合代码、组合名称、输入码" v-model="groupInput" clearable></el-input>
                  <el-button @click="savePure" style="margin-left: 20px">确定</el-button>
                  <el-button @click="groupVisible = false">取消</el-button>
              </div>
              <div class="mediumgroup-table">
                  <vxe-table show-overflow ref="xTable4" :data.sync="xTable4List" height="auto" width="100%" border size="mini" show-header-overflow header-align="center" highlight-current-row resizable stripe @cell-dblclick="groupCellDBLClickEvent">
                      <vxe-table-column field="mediumgroupno" sortable title="组合代码" width="80" show-overflow></vxe-table-column>
                      <vxe-table-column field="mediumgroupname" sortable title="培养基组合名称" width="120" show-overflow></vxe-table-column>
                      <vxe-table-column field="comments" sortable title="备注" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="pureflag" sortable title="类型" width="80" show-overflow></vxe-table-column>
                      <vxe-table-column field="inputcode" sortable title="输入码" width="80"></vxe-table-column>
                      <vxe-table-column field="seq" sortable title="序号 " width="80" align="center"></vxe-table-column>
                  </vxe-table>
              </div>
          </div>
      </el-dialog>
  </div>
</template>
<script>
import { Promise } from "q";
import XE from "xe-utils";
export default {
  props: ["PatientInfo", "rptunitid", "pOptions", "h", "w"],
  name: "LIS310",
  data() {
      return {
          DelIndex: -1,
          fixtop: 200,

          myrptunitid: this.rptunitid,
          tableDataResult: [],
          showmedrptitemcode:"",
          noupdateflag: true,
          tableDataResultOld: [],
          tableResultColumn: [],
          loadingResult: false,
          InputMsg: [],

          dialogRptVisible: false,

          selectConfig: { tigger: "row" },
          keyConfig: {
              isDel: true,
              isTab: true,
              isEdit: true,
          },
          tempRptItem: {},
          tempRptIndex: 0,
          xscrollflag: true,
          oldval: "",
          //报告结果选择开窗
          dialogResultVisible: false,
          Resultqcode: "",
          tableDataResultAll: [],
          tableDataResultS: [],
          tableColumnResultAll: [],
          editflag: true,
          Options: this.pOptions,
          Refreshflag: false,
          //评语开窗
          appendChangeRow: false, //评语行追加标志
          dialogCommentVisible: false, //评语显示标志
          tableDataComment: [], //评语显示数据
          tableDataCommentAll: [], //评语全部数据
          advicetxt: "", //评语文字
          advicesearchtxt: "", //评语查询关键字
          //药敏组合弹窗
          dialogMedGroupVisible: false,
          //药敏数据
          MedTotalData: [],
          tableDataMed: [],
          //删除的药敏数据 提示用
          DelMedTotalData:[],
          loadingMed: false,
          tableMedColumn: [],
          SelectRptitemCode: "",
          dialogMedVisible: false,
          tempMedItem: {},
          resultflagwidth: "200px",
          result6width: "100px",
          ddlData: [],
          ddlmedData: [],
          //评语数据
          germcomment: "",
          tabvalue: "1",
          commentnum: 4,
          //菌落计数弹窗
          dialogGermCountVisible: false,
          //下拉框展示
          textvalueshow: false,
          iconclass: "el-icon-arrow-down",
          //流程单数据
          TabSheet: "1",
          reportviewstr: "",
          ShowSheet: true,
          sheetchangflag: false,
          Sheetdate: "",
          Sheetuser: "", //接种人
          Sheetusername: "", //接种人
          Recieveuser: "", //接收人
          Recieveusername: "", //接收人
          Medium: "", //培养基
          Conditions: "", //培养条件
          Smear: "", //涂片结果
          Dyeing: "", //染色结果
          ColonyResult: "", //菌落特征
          ColonyNum: "", //菌落计数
          OtherResult: "", //其他结果
          //培养基
          groupVisible: false,
          poppureflag: "4",
          groupInput: "",
          xTable4List: [],
          getmediumgroupList: [],
          //药敏复查标记
          medRedoResultList:[
              { name: " ", value: "0" },
              { name: "需要复查", value: "1" },
              { name: "已复查", value: "2" },
          ],
          medresultList:[],
          multichktitle:"",
          option1:[],
          option2:[],
          dialogMultipleVisible:false,
          fieldname:"",
          changeTablerow:"",
          resdatadictList:[],

      };
  },
  components: {},
  created() {
      this.InitPageData();
  },
  mounted() {
      // 监听body上的点击
      document.querySelector("body").addEventListener("click", this.closeMenu);
      this.getMedResultList();
  },
  beforeDestroy() {
      // 移除监听
      document.querySelector("body").removeEventListener("click", this.closeMenu);
      localStorage.setItem("RM_LAB_REPORT_FIXTOP", this.$refs.layouttop.fixsizeLocal);
  },
  updated() {},
  methods: {
      InitPageData() {
          //this.QueryMed();
          var fixtop = localStorage.getItem("RM_LAB_REPORT_FIXTOP");
          this.fixtop = fixtop ? fixtop - 0 : 200;
          this.getMediumGroup();
      },
      getMedResultList(){
          this.$ddldata.getMedResultList().then((data) =>{
              this.medresultList=data;
          })
      },
      //上方按钮功能

      //新增
      ResultAdd(initrow) {
          return new Promise((s, f) => {
              this.GetTotalMedData(this.PatientInfo.reportid);
              if (initrow && initrow.rpt_itemcode) {
                  let frow = this.$refs.xTableResult.tableFullData.find((item) => item.rpt_itemcode == initrow.rpt_itemcode);
                  if (frow) {
                      this.$refs.xTableResult.setCurrentRow(frow).then(() => {
                          this.tempRptItem = frow;
                          this.$refs.xTableResult.setActiveCell(frow, "rpt_itemname").then(() => {
                              s();
                          });
                      });
                  } else {
                      this.$refs.xTableResult.insertAt(initrow, -1).then(() => {
                          let nowrow = this.$refs.xTableResult.tableFullData[this.$refs.xTableResult.tableFullData.length - 1];
                          this.$refs.xTableResult.setCurrentRow(nowrow).then(() => {
                              this.tempRptItem = nowrow;
                              this.$refs.xTableResult.setActiveCell(nowrow, "rpt_itemname").then(() => {
                                  s();
                              });
                          });
                      });
                  }
              } else {
                  var row = { rptunitid: this.myrptunitid, reportid: this.PatientInfo.reportid, result_str: "" };
                  this.$refs.xTableResult.insertAt(row, -1).then(() => {
                      let nowrow = this.$refs.xTableResult.tableFullData[this.$refs.xTableResult.tableFullData.length - 1];
                      this.$refs.xTableResult.setCurrentRow(nowrow).then(() => {
                          this.tempRptItem = nowrow;
                          this.$refs.xTableResult.setActiveCell(nowrow, "rpt_itemname").then(() => {
                              s();
                          });
                      });
                  });
              }
          });

          //this.$refs.xTableResult.$refs.tableBody.$children[0].focus();
      },
      ResultAddAsync(initrow) {
          let that = this;
          this.ResultAdd(initrow).then(() => {
              try {
                  that.$emit("change");
                  //del  此处异常，注释掉
                  // that.$refs.rptitemname.focus();
                  //this.$refs.xTableResult.$refs.tableBody.$children[0].focus();
                  that.QueryMed(initrow);
              } catch (err) {
                  console.log("err", err);
              }
          });
      },
      //删除
      ResultDel() {
          var crow = this.$refs.xTableResult.getCurrentRow();
          console.log("crow", crow.rpt_itemcode);
          if (crow) {
              this.MedTotalData = this.MedTotalData.filter((item) => item.rpt_itemcode != crow.rpt_itemcode);
              this.tableDataMed = [];
              this.$refs.xTableMed.loadData();
              console.log("this.$refs.xTableMed.getTableData().fullData.length", this.$refs.xTableMed.getTableData().fullData.length);
          }
          var row = this.$table.DelRecordSelect(this.$refs.xTableResult, this.DelIndex, this);
          //var row = this.$refs.xTableResult.getCurrentRow();
          this.$refs.xTableResult.setActiveCell(row, "rpt_itemname");
          if (row && row.rpt_itemcode && row.reportid) {
              this.tempRptItem = row;
              this.QueryMed(row);
          } else {
              this.QueryMed();
          }
      },
      ResultDelAsync() {
          new Promise((resolve) => {
              this.ResultDel();
              resolve();
          }).then(() => {
              this.$emit("change");
              this.$refs.xTableResult.$refs.tableBody.$children[0].focus();
          });
      },
      ClearNoDoItems() {
          return new Promise((s, f) => {
              if (this.editflag) {
                  var delrow = [];
                  this.$refs.xTableResult.tableFullData.forEach((t) => {
                      if (!t.result_str || t.result_str == "" || t.result_str == "未做") {
                          delrow.push(t);
                      }
                  });
                  delrow.forEach((element) => {
                      this.$refs.xTableResult.remove(element);
                  });
                  // var tmplis = this.tableDataResult.filter(t => t.result_str && t.result_str != "" && t.result_str != "未做");
                  // this.tableDataResult = tmplis;
                  s();
              } else {
                  f();
              }
          });
      },
      //表格功能
      currentResultChangeEvent({ row }) {
          this.tempRptItem = row;
          this.QueryMed(row);
          //console.log(row);
      },
      ColumnClassName({ seq, row, rowIndex, $rowIndex, column }) {
          if (column.property != "rpt_itemname" && column.property != "result_str" && column.property != "alertflag" && column.property != "redo_flag" && column.property != "modify_flag" && column.property != "result1" && column.property != "result2" && column.property != "result3" && column.property != "result4") {
              var style = "";
              if (row.keyitem == "1") style += "fontbold";
              style += " disabled-cell paddingcolumn";
              return style;
          }
          if (column.property == "alertflag" || column.property == "redo_flag" || column.property == "modify_flag") {
              return "disabled-cell";
          }
          if (column.property == "rpt_itemname") {
              var style = "";
              if (row.keyitem == "1") style += "fontbold";
              if (row.lab_rptunit_item_unprintflag == "1") {
                  style += " unprint";
                  return style;
              }
              if (row.alertflag) {
                  if (row.alertflag.trim() - 0) {
                      style += " danger paddingcolumn";
                      return style;
                  } else {
                      style += " paddingcolumn";
                      return style;
                  }
              } else {
                  style += " paddingcolumn";
                  return style;
              }
          }
          if (row.keyitem == "1") {
              return "fontbold";
          }
      },
      ColumnGermClassName({ seq, row, rowIndex, $rowIndex, column }) {
          if (column.property == "result6") {
              return "disabled-cell paddingcolumn";
          }else if (column.property === "medname"){
              if(row.isimportant=="1"){
                  console.log("row",row)
                  return "rm-red1";
              }
          }
      },
      ResultClassName(row) {
          var stylestr = "padding:0 3px;";
          if (row.alertflag > 0) stylestr += "background-color:" + (this.Options.alertflagcolor ? this.Options.alertflagcolor : "red");
          return stylestr;
      },
      ResultClassGerm(row) {
          var stylestr = "padding:0 3px;";
          if (this.Options.resultcolor_mode == "1") stylestr += "color:";
          else stylestr += "background-color:";
          if (row.medresult && row.medresult.indexOf("阳性") > -1) {
              stylestr += this.Options.resultcolor_p;
              return stylestr;
          }
          switch (row.result_flag) {
              case "R":
                  stylestr += this.Options.resultcolor_r;
                  break;
              case "I":
                  stylestr += this.Options.resultcolor_i;
                  break;
              case "S":
                  stylestr += this.Options.resultcolor_m;
                  break;
              case "N":
                  stylestr += "";
                  break;
              case "SDD":
                  stylestr += this.Options.resultcolor_i;
                  break;
              case "n":
                  stylestr += this.Options.resultcolor_e;
                  break;
              default:
                  stylestr += this.Options.resultcolor_ns;
                  break;
          }
          return stylestr;
      },
      ResultClass(row) {
          var stylestr = "padding:0 3px;";
          if (this.Options.resultcolor_mode == "1") stylestr += "color:";
          else stylestr += "background-color:";
          switch (row.result_flag) {
              case "M":
                  stylestr += this.Options.resultcolor_m;
                  break;
              case "H":
                  stylestr += this.Options.resultcolor_h;
                  break;
              case "L":
                  stylestr += this.Options.resultcolor_l;
                  break;
              case "P":
                  stylestr += this.Options.resultcolor_p;
                  break;
              case "W":
                  stylestr += this.Options.resultcolor_w;
                  break;
              case "E":
                  stylestr += this.Options.resultcolor_e;
                  break;
              case "Q":
                  stylestr += this.Options.resultcolor_r;
                  break;
              default:
                  stylestr += this.Options.resultcolor_m;
                  break;
          }
          if (row.result_str == "未做") {
              stylestr += ";color: #0095D9";
          }
          return stylestr;
      },
      ReusltflagName(flag) {
          switch (flag) {
              case "M":
                  return "正常";
              case "H":
                  return "偏高";
              case "L":
                  return "偏低";
              case "P":
                  return "阳性";
              case "W":
                  return "弱阳性";
              case "E":
                  return "错误";
              case "Q":
                  return "非敏感";
              default:
                  return "";
          }
      },
      ResultActive({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }) {
          if (!this.editflag) return;
          if (column.property == "result_str") {
              this.QueryResultAll(row.rpt_itemcode, 0);
              // this.oldval = row.result_str;
          }
          if (column.property == "rpt_itemname") {
              // this.$nextTick(() => {
              //     if (this.$refs.rptitemname) {
              //         this.$refs.rptitemname.focus();
              //     }
              // });
              // this.oldval = row.rpt_itemcode;
          }
          this.oldval = row[column.property];
      },
      ResultClose({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }) {
          if (!this.editflag) return;
          if (column.property == "result_str") {
              if (row.result_str) {
                  var selectrow = this.tableDataResultAll.filter((item) => item.inputcode == row.result_str);
                  if (selectrow.length > 0) {
                      row.result_str = selectrow[0].textvalue;
                  }
              }
              this.StrChange(row);
              //this.CalcRef(row);
          }
          if (column.property == "rpt_itemname") {
              //this.rptitemInput(row);
              //if (row.rpt_itemcode != this.oldval) this.$emit("change");
          }
          if (this.oldval != row[column.property]) this.$emit("change");
      },
      CalcGerm(val, field, row, rowIndex) {
          if (field == "rad" || field == "mic") {
              this.MedCalc(row, rowIndex);
          }
      },
      async rptitemInput(row) {
          if (!this.ddlData.length) {
              this.ddlData = await this.$ddldata.getallrptitem();
              this.ddlData = this.ddlData.filter((item) => item.germflagid != "0");
          }
          var select = this.ddlData.filter((item) => item.rpt_itemcode.toUpperCase() == row.rpt_itemname.toUpperCase() || item.itemcode_en.toUpperCase() == row.rpt_itemname.toUpperCase() || item.rpt_itemname.toUpperCase() == row.rpt_itemname.toUpperCase() || item.inputcode.toUpperCase() == row.rpt_itemname.toUpperCase());
          if (select && select.length > 0) {
              this.tempRptItem = row;
              this.addrptitem(select[0].rpt_itemcode, select[0].rpt_itemname, select[0]);
          } else {
              row.rpt_itemname = "";
          }
      },
      async medInput(row) {
          if (!this.ddlmedData.length) {
              this.ddlmedData = await this.$ddldata.getalllabmed();
          }
          var select = this.ddlmedData.filter((item) => item.medcode.toUpperCase() == row.medname.toUpperCase() || item.medname.toUpperCase() == row.medname.toUpperCase() || item.medname_en.toUpperCase() == row.medname.toUpperCase() || item.inputcode.toUpperCase() == row.medname.toUpperCase());
          console.log("select", select);
          if (select && select.length > 0) {
              this.tempMedItem = row;
              this.MedChange(select[0].medcode, select[0].medname, select[0]);
          } else {
              row.medname = "";
          }
      },
      MedMove(row, type, index, coltype) {
          if (type == 1) {
              if (index < this.$refs.xTableMed.tableFullData.length - 1) {
                  var row = this.$refs.xTableMed.tableFullData[index + 1];
                  this.$refs.xTableMed.setCurrentRow(row);
                  this.$refs.xTableMed.setActiveCell(row, coltype);
              }
          } else {
              if (index != 0) {
                  var row = this.$refs.xTableMed.tableFullData[index - 1];
                  this.$refs.xTableMed.setCurrentRow(row);
                  this.$refs.xTableMed.setActiveCell(row, coltype);
              }
          }
      },
      AddRowGerm(row, rowIndex, coltype2) {
          var resultrow = this.$refs.xTableResult.getCurrentRow();
          var lastrow = this.$refs.xTableMed.tableFullData[this.$refs.xTableMed.tableFullData.length - 1];
          if (lastrow._XID == row._XID) {
              var newrow = { rpt_itemcode: resultrow.rpt_itemcode, reportid: this.PatientInfo.reportid };
              this.$refs.xTableMed.insertAt(newrow, -1).then(() => {
                  var nowrow = this.$refs.xTableMed.tableFullData[this.$refs.xTableMed.tableFullData.length - 1];
                  this.$nextTick(() => {
                      this.$refs.xTableMed.setCurrentRow(nowrow);
                      this.$refs.xTableMed.clearSelected();
                      this.$refs.xTableMed.clearActived();
                      this.$refs.xTableMed.setActiveCell(nowrow, "medname");
                  });
              });
          } else {
              var thisrow = this.$refs.xTableMed.tableFullData[rowIndex + 1];
              //thisrow = this.$refs.xTableMed.getCurrentRow();
              this.$nextTick(() => {
                  this.$refs.xTableMed.setCurrentRow(thisrow);
                  this.$refs.xTableMed.clearSelected();
                  this.$refs.xTableMed.clearActived();
                  this.$nextTick(() => {
                      if (thisrow) {
                          this.$refs.xTableMed.setActiveCell(thisrow, coltype2);
                      }
                  });
              });
          }
      },
      listsearch() {
          var val = this.listsearchkey;
          this.tableDataListS = this.tableDataList.filter((item) => {
              return item.pat_name.toUpperCase().indexOf(val.toUpperCase()) > -1 || item.barcode.toUpperCase().indexOf(val.toUpperCase()) > -1;
          });
      },
      ResultMove(row, type, index, coltype) {
          if (type == 1) {
              if (index < this.$refs.xTableResult.tableFullData.length - 1) {
                  var row = this.$refs.xTableResult.tableFullData[index + 1];
                  this.$refs.xTableResult.setCurrentRow(row);
                  if (coltype == "rpt_itemname") {
                      this.$refs.xTableResult.setActiveCell(row, "rpt_itemname");
                  } else {
                      this.$refs.xTableResult.setActiveCell(row, "result_str");
                  }
              }
          } else {
              if (index != 0) {
                  var row = this.$refs.xTableResult.tableFullData[index - 1];
                  this.$refs.xTableResult.setCurrentRow(row);
                  if (coltype == "rpt_itemname") {
                      this.$refs.xTableResult.setActiveCell(row, "rpt_itemname");
                  } else {
                      this.$refs.xTableResult.setActiveCell(row, "result_str");
                  }
              }
          }
      },
      ListDblClick({ row, rowIndex, $rowIndex, column }) {
          if (column.property == "pat_name" && this.Options.doublefilterpatname > 0) {
              this.tableDataListS = this.tableDataList.filter((item) => item.pat_name == row.pat_name);
          }
          if (column.property == "req_reason" && this.Options.doublefilterrs > 0) {
              this.tableDataListS = this.tableDataList.filter((item) => item.req_reason == row.req_reason);
          }
          if (column.property == "specimen_code" && this.Options.doublefilterrs > 0) {
              this.tableDataListS = this.tableDataList.filter((item) => item.specimen_code == row.specimen_code);
          }
      },
      ResultCellClick({ row, column }) {
          if (!this.editflag || row.alertrelease == "1") return;
          // if (column.property == "redo_flag") {
          //     var redo = "0";
          //     if (row.redo_flag == "1" || row.redo_flag == "M") redo = "2";
          //     else if (row.redo_flag == "2") redo = "N";
          //     else if (row.redo_flag == "0" || row.redo_flag == "N") redo = "M";
          //     this.SaveNeedRechk(row, redo);
          // }
      },
      DblEvent({ row, rowIndex, $rowIndex, column },t) {
          if (!this.editflag) return;
          switch (column.property) {
              case "rpt_itemname":
                  this.dialogRptVisible = true;
                  this.$nextTick(() => {
                      this.$refs.rptdialog.$refs.qcodeinput.focus();
                  });
                  this.tempRptItem = row;
                  this.tempRptIndex = rowIndex;
                  break;
              case "result1":
                  this.dialogGermCountVisible = true;
                  this.$nextTick(() => {
                      this.$refs.germcountdialog.$refs.qcodeinput.focus();
                  });
                  this.tempRptItem = row;
                  this.tempRptIndex = rowIndex;
                  break;
              case "redo_flag":
                  if(t!='S'){
                      var redo = "M";
                      if (row.redo_flag == "1" || row.redo_flag == "M") redo = "2";
                      else if (row.redo_flag == "2") redo = "N";
                      else redo = "M";
                      this.SaveNeedRechk(row, redo);
                  }
                  break;
          }
      },
      //双击弹窗添加项目
      addrptitem(c, n, row) {
          var rename = "";
          switch (this.Options.itemshowmode) {
              case "1":
                  rename = "[" + row.itemcode_en + "]";
                  break;
              case "2":
                  rename = n + " [" + row.itemcode_en + "]";
                  break;
              case "3":
                  rename = n;
                  break;
              case "4":
                  rename = "[" + row.itemcode_en + "] " + n;
                  break;
              case "5":
                  rename = c;
                  break;
              default:
                  rename = "[" + row.itemcode_en + "] " + n;
                  break;
          }

          var currentrow = this.$refs.xTableResult.getCurrentRow();
          var rowindex = this.$refs.xTableResult.getRowIndex(currentrow);
          var hasrow = this.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == c);
          if (hasrow.length > 0) {
              this.$confirm("不能选择重复的项目", "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  focusCancelButton: false,
                  type: "warning",
              })
                  .then(() => {
                      this.tempRptItem.rpt_itemname = "";
                      this.$refs.xTableResult.setActiveCell(currentrow, "rpt_itemname").then(() => {
                          if (this.$refs.rptitemname) {
                              this.$refs.rptitemname.focus();
                          }
                      });
                  })
                  .catch(() => {
                      this.tempRptItem.rpt_itemname = "";
                      this.$refs.xTableResult.setActiveCell(currentrow, "rpt_itemname").then(() => {
                          if (this.$refs.rptitemname) {
                              this.$refs.rptitemname.focus();
                          }
                      });
                  });
          } else {
              var meddata = this.MedTotalData.filter((item) => item.rpt_itemcode == this.tempRptItem.rpt_itemcode);
              for (let i = 0; i < meddata.length; i++) {
                  meddata[i].rpt_itemcode = c;
              }
              this.tempRptItem.rpt_itemcode = c;
              this.tempRptItem.rpt_itemname = rename;
              this.tempRptItem.result_unit = row.result_unit;
              this.tempRptItem.result_ref = row.result_ref;
              this.tempRptItem.germflag = row.germflagid;
              this.tempRptItem.keyitem = row.keyitem;
              for (let i = 0; i < this.$refs.xTableMed.tableFullData.length; i++) {
                  this.MedCalc(this.$refs.xTableMed.tableFullData[i], i, this.tempRptItem);
              }
              //if (row.germmedgroup)
              this.QueryMedGroup(row.germmedgroup);
              if (this.dialogRptVisible) {
                  this.$nextTick(() => {
                      this.$tool
                          .request({
                              url: "LIS/LIS3/LIS311",
                              method: "post",
                              data: {
                                  action: "queryresultdefaultval",
                                  rpt_itemcode: row.rpt_itemcode,
                                  rptunitid: this.myrptunitid,
                              },
                          })
                          .then((res) => {
                              if (res.val != "") {
                                  currentrow.result_str = res.val;
                              } else {
                                  currentrow.result_str = row.defaultval;
                              }
                          })
                          .catch((error) => {});

                      this.$refs.xTableResult.setActiveCell(currentrow, "result_str");
                  });
              }
          }

          this.dialogRptVisible = false;
      },
      SelectRptItems(rows) {
          var indexdata = this.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == "" || item.rpt_itemcode == null);
          var indexs = [];
          for (let j = 0; j < indexdata.length; j++) {
              indexs.push(this.$refs.xTableResult.tableFullData.indexOf(indexdata[j]));
          }
          for (let i = 0; i < rows.length; i++) {
              let row = rows[i];
              var hasrow = this.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == row.rpt_itemcode);
              if (hasrow.length > 0) continue;
              var rename = "";
              switch (this.Options.itemshowmode) {
                  case "1":
                      rename = "[" + row.itemcode_en + "]";
                      break;
                  case "2":
                      rename = row.rpt_itemname + " [" + row.itemcode_en + "]";
                      break;
                  case "3":
                      rename = row.rpt_itemname;
                      break;
                  case "4":
                      rename = "[" + row.itemcode_en + "] " + row.rpt_itemname;
                      break;
                  case "5":
                      rename = row.rpt_itemcode;
                      break;
                  default:
                      rename = "[" + row.itemcode_en + "] " + row.rpt_itemname;
                      break;
              }
              var insertrow = { rpt_itemname: rename, rpt_itemcode: row.rpt_itemcode, result_unit: row.unit, result_ref: row.ref_text, germflag: row.germflagid, testmethod: row.testmethod, itemcode_en: row.itemcode_en, rptunitid: this.myrptunitid, reportid: this.PatientInfo.reportid, result_str: "", keyitem: row.keyitem, germmedgroup: row.germmedgroup };
              if (i < indexs.length) {
                  for (var item in insertrow) {
                      this.$refs.xTableResult.tableFullData[indexs[i]][item] = insertrow[item];
                  }
                  var showflag = true;
                  if (i == 0) showflag = false;
                  //if (row.germmedgroup)
                  this.QueryMedGroup(row.germmedgroup, row.rpt_itemcode, showflag);
              } else {
                  this.$refs.xTableResult.insertAt(insertrow, -1);
                  //if (row.germmedgroup)
                  this.QueryMedGroup(row.germmedgroup, row.rpt_itemcode, true);
              }
          }
          var currentrow = this.$refs.xTableResult.getCurrentRow();
          if (this.dialogRptVisible) {
              this.$nextTick(() => {
                  this.$refs.xTableResult.setActiveCell(currentrow, "result_str");
              });
          }
          this.dialogRptVisible = false;
      },
      CenterDblClick(e) {
          this.ResultAddAsync();
      },
      RefreshOptions(p) {
          this.Options = p;
          //console.log("option",p);
          this.tableResultColumn = this.Options.rCols;
          this.ShowSheet = this.Options.showgermsheet == "1";
          if (!this.tableResultColumn.find((item) => item.field == "result_txt")) {
              this.tableResultColumn.push({ field: "result_txt", title: "文本结果", width: "1" });
          }
      },
      ClearTableDate() {
          return new Promise((s, f) => {
              this.tableDataResult = [];
              this.editflag = true;
              s();
          });
      },
      QueryResult(rptinfo) {
          return new Promise((s, f) => {
              this.Refreshflag = true;
              let reportid = rptinfo.reportid;
              if (rptinfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && $tool.getSession(this.$tool.loginuserno) != rptinfo["report_user"]) || (rptinfo.barcode && rptinfo.barcode.indexOf("-退") > -1)) {
                  this.editflag = false;
              } else {
                  this.editflag = true;
              }
              if(this.TabSheet == "3"){
                  if (reportid) {
                      this.queryreportview(reportid);
                  } else {
                      this.queryreportview("no");
                  }
              }
              this.$tool
                  .request({
                      url: "LIS/LIS3/LIS310",
                      method: "post",
                      data: {
                          action: "queryresultlist",
                          reportid: reportid,
                          rptunitid: this.myrptunitid,
                          sampleno: rptinfo.sampleno,
                          sampledate: rptinfo.sampledate,
                          prgno: "LIS311",
                      },
                  })
                  .then((res) => {
                      this.tableDataResult = res.vxtab.Data;
                      // for (let i = 0; i < this.tableDataResult.length; i++) {
                      //     if (this.tableDataResult[i].result4) this.tableDataResult[i].result4 = this.tableDataResult[i].result4.toUpperCase();
                      // }
                      // rptinfo.redo_flag = res.redo_flag;
                      // rptinfo.alter_flag = res.alter_flag;
                      this.loadingResult = false;
                      this.Refreshflag = false;
                      var returndata = { res: res.rptinfo, redo: res.redo, history: res.history, iscontainBacteria: res.iscontainBacteria };

                      //this.tableResultColumn.filter(item => item.field == "cp_lastresult")[0].title = res.historytitle;
                      let col = this.tableResultColumn.filter((item) => item.field == "cp_lastresult");
                      if (col != null && col.length > 0) {
                          //如果有值就显示，没有就用默认历史结果
                          if(res.historytitle) col[0].title = res.historytitle;
                          else col[0].title = "历史结果";
                      }

                      this.noupdateflag = true;
                      this.tableDataResultOld = [];
                      //初始化的时候设置一次就可以
                      //this.tableResultColumn = res.Cols;
                      this.loadingResult = false;
                      //不在前台做待审核状态判断了
                      //var renum = 1;
                      //if (res.vxtab.Data && res.vxtab.Data.length > 0) renum = this.tableDataResult.filter((item) => item.result_str == "未做").length;
                      this.showmedrptitemcode=res.showmedrptitemcode;
                      if (this.ShowSheet) this.QuerySheet(res.rptinfo ? res.rptinfo.reportid : "", res.rptinfo ? res.rptinfo.barcode : "");
                      this.$emit("PatChange", res.rptinfo, res.prechkflag, "");
                      s(returndata);
                  })
                  .catch((error) => {
                      this.loadingResult = false;
                      this.$message.error("错误:" + error);
                      this.QueryMed();
                      f();
                  });
          });
      },
      //Mod by yangl 2021-03-22  修正药敏结果的BUG，参数没有统一的BUG
      //QueryMed(row)
      QueryMed(row, rptitemcode, reportid,reTotleMedData) {
          // debugger;
          // let rptitemcode = "";
          // let reportid = "";
          this.germcomment = "";
          if (row) {
              rptitemcode = row.rpt_itemcode;
              reportid = row.reportid;
              this.tempRptItem = row;
          }
          this.loadingMed = true;
          // if(!reporid) reportid = this.PatientInfo.reportid;
          // if (this.$refs.xTableMed.getTableData().fullData.length > 0) {
          //     var rptcode = this.$refs.xTableMed.tableFullData[0].rpt_itemcode;
          //     this.MedTotalData = this.MedTotalData.filter(item => item.rpt_itemcode != rptcode && item.reportid == reportid);
          //     for (let i = 0; i < this.$refs.xTableMed.tableFullData.length; i++) {
          //         this.MedTotalData.push(this.$refs.xTableMed.tableFullData[i]);
          //     }
          // }
          // else{
          //     var removerows = this.$refs.xTableMed.getRemoveRecords();
          //     if(removerows.length>0)
          //     {
          //        var rptcode = removerows[0].rpt_itemcode;
          //        this.MedTotalData = this.MedTotalData.filter(item => item.rpt_itemcode != rptcode && item.reportid == reportid);
          //          this.MedTotalData.push({ reportid:reportid,rpt_itemcode:rptcode,medcode:"-9992DEL" });

          //     }
          // }
          //取消提醒的参数，取消之后直接请求
          if(!reTotleMedData){
              //处理当前显示的药敏，将当前药敏加到MedTotalData中
              this.GetTotalMedData(reportid);
          }
          // 记录完当前显示的药敏后，要将当前显示清空
          this.tableDataMed = [];
          //console.log("【QueryMed】this.MedTotalData",this.MedTotalData);
          if (this.MedTotalData.filter((item) => item.rpt_itemcode == rptitemcode && item.reportid == reportid).length > 0) {
              this.tableDataMed = this.MedTotalData.filter((item) => item.rpt_itemcode == rptitemcode && item.reportid == reportid && item.medcode != "-9992DEL");
              //this.$forceUpdate();
              this.loadingMed = false;
          } else {
              this.$tool
                  .request({
                      url: "LIS/LIS3/LIS311",
                      method: "post",
                      data: {
                          action: "queryresultmed",
                          reportid: reportid ? reportid : this.PatientInfo.reportid,
                          rpt_itemcode: rptitemcode,
                      },
                  })
                  .then((res) => {
                      if (!res.hasOwnProperty("errcode")) {
                          if (res.Data) {
                              for (let i = 0; i < res.Data.length; i++) {
                                  if (res.Data[i].medmethod.toUpperCase() == "KB") res.Data[i].medmethod = "KB";
                                  else if (res.Data[i].medmethod.toUpperCase() == "MIC") res.Data[i].medmethod = "MIC";
                                  else if (res.Data[i].medmethod.toUpperCase() == "ETEST") res.Data[i].medmethod = "Etest";
                              }
                              res.Data.forEach((element) => { //新增old参数值，为了切换时提醒。
                                  element.oldmedcode = element.medcode;
                                  element.oldmedname = element.medname;
                                  element.oldrad = element.rad;
                                  element.oldmic = element.mic;
                                  element.oldmedresult = element.medresult;
                              });
                          }
                          this.tableDataMed = res.Data;
                          this.tableMedColumn = res.Cols;
                          if (res.Data.length > 0) {
                              for (let i = 0; i < res.Data.length; i++) {
                                  res.Data[i].reportid = reportid ? reportid : this.PatientInfo.reportid;
                                  this.MedTotalData.push(res.Data[i]);
                              }
                          }
                          //console.log("【QueryMed】请求之后 this.MedTotalData",this.MedTotalData);
                      }
                      this.loadingMed = false;
                  })
                  .catch((error) => {
                      this.$message.error("错误:" + error);
                      this.loadingMed = false;
                  });
          }
      },
      //inputflag输入标志 表示是否从输入模板中获取
      QueryMedGroup(medgroupcode, rptitemcode, showflag, inputflag) {
          if (!rptitemcode) {
              var rptrow = this.$refs.xTableResult.getCurrentRow();
              rptitemcode = rptrow.rpt_itemcode;
          }

          this.loadingMed = true;
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS311",
                  method: "post",
                  data: {
                      action: "labmedgroupdateil",
                      reportid: this.PatientInfo.reportid,
                      rpt_itemcode: rptitemcode,
                      medgroupcode: medgroupcode,
                      inputflag: inputflag,
                      specimen_code: this.PatientInfo.specimen_code,
                  },
              })
              .then((res) => {
                  if (!res.hasOwnProperty("errcode")) {
                      for (let i = 0; i < res.Data.length; i++) {
                          var row = this.$refs.xTableMed.tableFullData.filter((item) => item.medcode == res.Data[i].medcode);
                          if (row.length == 0) {
                              var insertrow = res.Data[i];
                              insertrow.rad = insertrow.defaultrad;
                              insertrow.mic = insertrow.defaultmic;
                              insertrow.result_flag = insertrow.loadresultflag;
                              insertrow.medresult = insertrow.defaultresult;
                              insertrow.reportid = this.PatientInfo.reportid;
                              insertrow.rpt_itemcode = rptitemcode;

                              insertrow.medmethod = this.$pub.formatmethod(insertrow.appmethod);
                              insertrow.updateflag = 1;//新增
                              insertrow.oldrad = insertrow.rad;
                              insertrow.oldmic = insertrow.mic;

                              if (!showflag) this.$refs.xTableMed.insertAt(insertrow, -1);
                              this.MedTotalData.push(insertrow);
                          }
                      }
                      let currow = this.$refs.xTableMed.tableData[this.$refs.xTableMed.tableData.length - 1];
                      this.$refs.xTableMed.setCurrentRow(currow).then(()=>{
                          this.$refs.xTableMed.scrollToRow(currow);
                      });
                      //this.tableDataMed = res.Data;
                      this.tableMedColumn = res.Cols;
                  }
                  this.loadingMed = false;
              })
              .catch((error) => {
                  this.$message.error("错误:" + error);
              });
      },
      QuerySheet(reportid, barcode) {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS311",
                  method: "post",
                  data: {
                      action: "querysheet",
                      reportid: reportid ? reportid : this.PatientInfo.reportid,
                      barcode: barcode ? barcode : this.PatientInfo.barcode,
                  },
              })
              .then((res) => {
                  if (!res.hasOwnProperty("errcode")) {
                      if (res.length == 1) res = res[0];
                      this.Sheetdate = res.sheetdate;
                      this.Sheetuser = res.sheetuser;
                      this.Sheetusername = res.sheetname;
                      this.Recieveuser = res.receiveuser;
                      this.Recieveusername = res.recievename;
                      this.Medium = res.medium; //培养基
                      this.Conditions = res.condtions; //培养条件
                      this.Smear = res.smear; //涂片结果
                      this.Dyeing = res.dyeing; //染色结果
                      this.ColonyResult = res.colonyresult; //菌落特征
                      this.ColonyNum = res.colonynum; //菌落计数
                      this.OtherResult = res.otherresult; //其他解雇哟
                  }
                  // row.medresult = "敏感";
                  // row.result_flag = "R";
              });
      },
      MedCalc(row, rowIndex, rptrow) {
          if (!rptrow) rptrow = this.$refs.xTableResult.getCurrentRow();
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS311",
                  method: "post",
                  data: {
                      action: "calcmedresultflag",
                      reportid: this.PatientInfo.reportid,
                      rpt_itemcode: rptrow.rpt_itemcode,
                      medcode: row.medcode,
                      rad: row.rad,
                      mic: row.mic,
                      medmethod: row.medmethod,
                  },
              })
              .then((res) => {
                  if (res) {
                      if (res.resultstr) this.$refs.xTableMed.tableFullData[rowIndex].medresult = res.resultstr;
                      if (res.resultflag) this.$refs.xTableMed.tableFullData[rowIndex].result_flag = res.resultflag;
                      if (res.result6) this.$refs.xTableMed.tableFullData[rowIndex].result6 = res.result6;
                      this.$refs.xTableMed.tableFullData[rowIndex].medgroup = res.medgroup;
                      this.$refs.xTableMed.tableFullData[rowIndex].guidelines = res.guidelines;
                      this.$refs.xTableMed.tableFullData[rowIndex].medremarks = res.medremarks;
                      this.$refs.xTableMed.tableFullData[rowIndex].isimportant = res.isimportant;
                      // var method = res.method.toUpperCase();
                      // if (method == "ETEST") method = "Etest";
                      this.$refs.xTableMed.tableFullData[rowIndex].medmethod = this.$pub.formatmethod(res.method);
                      //console.log("【MedCalc】this.$refs.xTableMed.getTableData().fullData",this.$refs.xTableMed.getTableData().fullData);
                      var meddata = this.MedTotalData.filter((item) => item.rpt_itemcode == rptrow.rpt_itemcode && item.reportid == this.PatientInfo.reportid);
                      //console.log("meddata",meddata);
                      var indexrow=this.$refs.xTableMed.tableFullData[rowIndex];

                      this.MedTotalData.forEach((element,index) => {
                          if(element._XID == indexrow._XID && indexrow.rpt_itemcode == element.rpt_itemcode && element.reportid == this.PatientInfo.reportid && element.updateflag != -1){
                              if(!indexrow.updateflag) indexrow.updateflag=element.updateflag;//不存在时先个赋值
                              if(element.updateflag!=1) indexrow.updateflag=2;//赋值为更新状态
                              this.$set(this.MedTotalData,index,indexrow);
                          }
                      })

                  }
                  // row.medresult = "敏感";
                  // row.result_flag = "R";
              });
      },
      // QueryResult(rptinfo) {
      //     return Promise((s,f)=>{
      //         this.Refreshflag = true;
      //         let reportid = rptinfo.reportid;
      //         if (rptinfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && $tool.getSession(this.$tool.loginuserno) != rptinfo["report_user"])) {
      //             this.editflag = false;
      //         } else {
      //             this.editflag = true;
      //         }
      //         this.$tool
      //             .request({
      //                 url: "LIS/LIS3/LIS310",
      //                 method: "post",
      //                 data: {
      //                     action: "queryresultlist",
      //                     reportid: reportid,
      //                     rptunitid: this.myrptunitid
      //                 }
      //             })
      //             .then(res => {
      //                 this.tableDataResult = res.Data;
      //                 this.loadingResult = false;
      //                 this.Refreshflag = false;
      //                 s();
      //             })
      //             .catch(error => {
      //                 this.$message.error("错误:" + error);
      //                 this.Refreshflag = false;
      //                 f()
      //             });
      //     })

      // },

      //后台调用计算参考值
      CalcRef(row) {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS310",
                  method: "post",
                  data: {
                      action: "calcref",
                      sex: this.PatientInfo.pat_sex,
                      ageyear: this.PatientInfo.pat_birth ? this.PatientInfo.pat_birth : this.PatientInfo.pat_agestr,
                      specimen: this.PatientInfo.specimen_code,
                      physicycle: this.PatientInfo.physicycle,
                      deptno: this.PatientInfo.req_deptno,
                      diagicd: this.PatientInfo.pat_diag_icd,
                      hospcode: this.PatientInfo.hospcode,
                      resultrow: row,
                  },
              })
              .then((res) => {
                  for (var item in res) {
                      row[item] = res[item];
                  }
              })
              .catch((error) => {
                  this.$message.error("错误:" + error);
              });
      },
      QueryResultAll(rptitemcode, rekind) {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS310",
                  method: "post",
                  data: {
                      action: "getrptitemval",
                      rpt_itemcode: rptitemcode,
                      resultkind: rekind,
                      rptunitid: this.myrptunitid,
                  },
              })
              .then((res) => {
                  //console.log(res);
                  this.tableColumnResultAll = res.Cols;
                  this.tableDataResultAll = res.Data;
                  this.tableDataResultS = res.Data;
                  //加入focus显示
                  if (this.tableDataResultAll.length > 0 && this.Options.showrptitemvalbyfocus == "2") {
                      this.textvalueshow = true;
                  }
              });
      },
      //病历号改变的逻辑

      //Result弹出框的各项方法
      ResultSearchInput(value) {},
      ResultSearchkeydown() {
          this.tableDataResultS = this.tableDataResultAll.filter((item) => item.textvalue.toUpperCase().indexOf(this.Resultqcode.toUpperCase()) > -1 || item.inputcode.toUpperCase().indexOf(this.Resultqcode.toUpperCase()) > -1 || (item.seq + "").indexOf(this.Resultqcode.toUpperCase()) > -1);
      },
      Resultok() {
          var row = this.$refs.xTableResultAll.getCurrentRow();
          if (row) {
              var uprow = this.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == row.rpt_itemcode)[0];
              uprow.result_flag = row.result_flag;
              uprow.redoflag = row.redoflag;
              uprow.limitflag = row.limitflag;
              uprow.result_str = row.textvalue;
              this.CalcRef(uprow);
              this.dialogResultVisible = false;
          } else {
              this.$message("未选中报告结果!");
          }
      },
      Resultcancel() {
          this.dialogResultVisible = false;
      },
      ResultSelect({ row }) {
          var uprow = this.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == row.rpt_itemcode)[0];
          uprow.result_flag = row.result_flag;
          uprow.redoflag = row.redoflag;
          uprow.limitflag = row.limitflag;
          uprow.result_str = row.textvalue;
          this.CalcRef(uprow);
          this.dialogResultVisible = false;
      },
      SpaceEvent(type) {
          var val = this.PatientInfo[type + "name"];
          if (!val.replace(/\s*/g, "")) {
              this.inputdblEvent(type);
          }
      },

      //危急值上报弹窗
      CheckDangerDeal(type) {
          var alertinfo = {
              chksendhis: this.sendbyhis ? "1" : "0",
              chkphone: this.noticebyphone ? "1" : "0",
              chkmessage: this.noticebymsg ? "1" : "0",
              chkrepeat: this.retelled ? "1" : "0",
              chkmsguser: this.msgtodutyman ? "1" : "0",
              chkmsggrdept: this.noticeinfec ? "1" : "0",
              alertuser: this.ExaminreportMan,
              rectelman: this.noticeddoctor,
              shortmsgtelnum: this.noticeddoctorno,
              memo: this.remarks,
          };
          this.CheckReportRequest(this.InputMsg, type, alertinfo);
      },
      //药敏组合选择
      MedGroupChange(c, v, row) {
          this.QueryMedGroup(c);
          this.$emit("change");
          this.dialogMedGroupVisible = false;
      },
      MedGroupAdd() {
          if (this.PatientInfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
          } else {
              var row = this.$refs.xTableResult.getCurrentRow();
              if (row) {
                  if (row.rpt_itemcode) {
                      this.dialogMedGroupVisible = true;
                  } else {
                      this.$alert("请先选择细菌!", "提示");
                  }
              } else {
                  this.$confirm("没有选中的报告项目", "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      type: "warning",
                  });
              }
          }
      },
      MedAdd() {
          if (this.PatientInfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
          } else {
              var row = this.$refs.xTableResult.getCurrentRow();
              if (row) {
                  if (row.rpt_itemcode) {
                      var newrow = { rpt_itemcode: row.rpt_itemcode, reportid: this.PatientInfo.reportid,updateflag: 1 };
                      this.$refs.xTableMed.insertAt(newrow, -1);
                      this.$emit("change");
                      this.$nextTick(() => {
                          let currow = this.$refs.xTableMed.tableData[this.$refs.xTableMed.tableData.length - 1];
                          this.$refs.xTableMed.setCurrentRow(currow).then(()=>{
                              this.$refs.xTableMed.scrollToRow(currow);
                          });
                      });
                  } else {
                      this.$alert("请先选择细菌!", "提示");
                  }
              } else {
                  this.$confirm("没有选中的报告项目", "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      type: "warning",
                  });
              }
          }
      },
      MedGroupDelAll() {
          if (this.PatientInfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
          } else {
              var data = this.$refs.xTableMed.tableData;
              if(data && data.length>0){
                  data.forEach((element)=>{
                      if(element.updateflag!=1){//非新增的药敏进行删除 数据加到DelMedTotalData里
                          this.DelMedTotalData=this.DelMedTotalData.filter((item)=>item.rpt_itemcode!=element.rpt_itemcode && item.medcode!=element.medcode && this.PatientInfo.reportid);
                          this.DelMedTotalData.push(element);
                      }
                      //删除新增的数据
                      if(element.updateflag==1){
                          //var delrow=this.MedTotalData.find((item)=> item._XID==element._XID && item.reportid == this.PatientInfo.reportid )
                          // 原来的delindex全是-1， 改成_XID可行，其他复杂情况未验证
                          // var delindex=this.MedTotalData.indexOf(element);
                          var delindex=this.MedTotalData.findIndex(t=>t._XID == element._XID);
                          this.MedTotalData.splice(delindex,1);
                      }
                  })
              }
              this.$refs.xTableMed.remove(this.$refs.xTableMed.tableData);
              //this.tableDataMed = [];
              this.$emit("change");
          }
      },
      MedGroupDel(delrowone) {
          if (this.PatientInfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
          } else {
              var delrow = {};
              if (!delrowone) delrow = this.$refs.xTableMed.getCurrentRow();
              else delrow = this.$refs.xTableMed.tableFullData.find((item) => item.medcode == delrowone.medcode);
              var row = this.$refs.xTableMed.tableData.filter((item) => item._XID < delrow._XID);
              var bigrow = this.$refs.xTableMed.tableData.filter((item) => item._XID > delrow._XID);
              if (delrow) {
                  //非新增的药敏进行删除 数据加到DelMedTotalData里
                  if(delrow.updateflag && delrow.updateflag!=1){
                      this.DelMedTotalData=this.DelMedTotalData.filter((item)=> item.rpt_itemcode!=delrow.rpt_itemcode && item.medcode!=delrow.medcode && item.reportid == this.PatientInfo.reportid);
                      this.DelMedTotalData.push(delrow);
                  }
                  //删除新增的数据
                  if(delrow.updateflag && delrow.updateflag==1){
                      var delindex=this.MedTotalData.findIndex(t=>t._XID == delrow._XID);
                      if(delindex > -1){
                          this.MedTotalData.splice(delindex,1);
                      }
                      // 原来的delrow不是数值，会导致本意是要删第二个细菌下面的药敏，错误的删成了第一个细菌下面的  改成_XID可行，其他复杂情况未验证
                      // this.MedTotalData.splice(delrow,1);
                      //this.MedTotalData=this.MedTotalData.filter((item)=> item._XID!=delrow._XID && item.reportid == this.PatientInfo.reportid)
                  }

                  this.$refs.xTableMed.remove(delrow);
                  this.$emit("change");
                  if (row.length > 0) {
                      this.$refs.xTableMed.setCurrentRow(this.$refs.xTableMed.tableData[row.length - 1]);
                  } else if (bigrow.length > 0) {
                      this.$refs.xTableMed.setCurrentRow(this.$refs.xTableMed.tableData[0]);
                  }
              } else {
                  this.$confirm("没有选中药敏项目", "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      type: "warning",
                  });
              }
          }
      },
      MedChange(c, v, row) {
          this.dialogMedVisible = false;
          var currentrow = this.$refs.xTableMed.getCurrentRow();
          console.log("MedChange.currentrow",currentrow);
          // var hasrow = this.$refs.xTableMed.tableData.filter((item) => item.medcode == c);
          // if (hasrow.length > 0) {
          //     this.$confirm("不能选择重复的项目!", "提示", {
          //         confirmButtonText: "确定",
          //         cancelButtonText: "取消",
          //         focusCancelButton: false,
          //         type: "warning",
          //     })
          //         .then(() => {})
          //         .catch(() => {});
          //     this.tempMedItem.medname = "";
          // } else {

          // }
          this.tempMedItem.medname = v;
          this.tempMedItem.medcode = c;
          this.tempMedItem.result6 = row.result6;
          this.tempMedItem.medconc = row.medconc;
          this.$nextTick(() => {
              this.$refs.xTableMed.setActiveCell(currentrow, "rad");
          });
          if(currentrow.updateflag!=1){//不是新增
              if(currentrow.oldmedcode != c && currentrow.oldmedname != v){//药敏发生改变
                  currentrow.updateflag=2;
              }
          }
          //若删除表里存在，就移除
          var delfindrow=this.DelMedTotalData.find((item)=> item.rpt_itemcode==currentrow.rpt_itemcode && item.medcode==c && item.reportid==this.PatientInfo.reportid)
          if(delfindrow){
              this.DelMedTotalData.remove(delfindrow);
          }
      },
      GermCountChange(c, v, row) {
          this.tempRptItem.result1 = v;
          this.dialogGermCountVisible = false;
      },
      SetResultflag(flag) {
          if (this.editflag) {
              var msg = "是否将全部结果改为" + (flag == "R" ? "耐药(R)" : "敏感(S)");
              var result = flag == "R" ? "耐药" : "敏感";
              this.$confirm(msg, "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  focusCancelButton: true,
                  closeOnClickModal: false,
                  type: "warning",
              }).then((then) => {
                  this.$emit("change");
                  for (let i = 0; i < this.$refs.xTableMed.tableFullData.length; i++) {
                      this.$refs.xTableMed.tableFullData[i].result_flag = flag;
                      this.$refs.xTableMed.tableFullData[i].medresult = result;

                      if(this.$refs.xTableMed.tableFullData[i].updateflag != 1){
                          if(this.$refs.xTableMed.tableFullData[i].oldmedresult != this.$refs.xTableMed.tableFullData[i].medresult){
                              this.$refs.xTableMed.tableFullData[i].updateflag=2;
                          }
                      }
                  }
                  // row.result_flag = flag;
              });
          }
      },
      rflagchange(val, row) {
          row.medresult = "";
          if(this.medresultList && this.medresultList.length>0){
              var hasrow=this.medresultList.find((item)=> item.value==val.toUpperCase());
              if(hasrow){
                  row.medresult=hasrow.name;
              }
          }else{
              switch (val) {
                  case "R":
                      row.medresult = "耐药";
                      break;
                  case "I":
                      row.medresult = "中介";
                      break;
                  case "S":
                      row.medresult = "敏感";
                      break;
                  case "N":
                  case "n":
                      row.medresult = "无";
                      break;
                  case "SDD":
                      row.medresult = "剂量依赖性敏感";
                      break;
                  case "NS":
                  case "ns":
                      row.medresult = "非敏感";
                      break;
                  case "WT":
                      row.medresult = "野生型";
                      break;
                  case "NWT":
                      row.medresult = "非野生型";
                      break;
              }
          }

          if(row.updateflag != 1){
              if(row.oldmedresult != row.medresult){
                  row.updateflag=2;
              }
          }
          this.$emit("change");
      },
      RedoMedResult(val ,row){
          var ret="";
          let redoresult=this.medRedoResultList.find((item) => item.value == val);
          if(redoresult){
              ret=redoresult.name;
          }
          return ret;
      },
      redoflagchange(val,row){
          row.redo_flag=val;
          this.$emit("change");
      },
      RedoResultClassGerm(row){
          let stylestr = "padding: 0 3px;";
          if(row.redo_flag=="1"){
               stylestr+="background-color:#FF8C00;"
          }else if (row.redo_flag=="2"){
              stylestr+="background-color:#9ACD32;"
          }
          return stylestr;
      },
      //切换同报告报告项目时保存对应药敏结果
      GetTotalMedData(reportid) {
          if (reportid == this.PatientInfo.reportid) {
              if (this.$refs.xTableMed.getTableData().fullData.length > 0) {
                  var rptcode = this.$refs.xTableMed.tableFullData[0].rpt_itemcode;
                  this.MedTotalData = this.MedTotalData.filter((item) => item.rpt_itemcode != rptcode && item.reportid == reportid);
                  for (let i = 0; i < this.$refs.xTableMed.tableFullData.length; i++) {
                      this.MedTotalData.push(this.$refs.xTableMed.tableFullData[i]);
                  }
              } else {
                  var removerows = this.$refs.xTableMed.getRemoveRecords();
                  if (removerows.length > 0) {
                      var rptcode = removerows[0].rpt_itemcode;
                      this.MedTotalData = this.MedTotalData.filter((item) => item.rpt_itemcode != rptcode && item.reportid == reportid);
                      this.MedTotalData.push({ reportid: reportid, rpt_itemcode: rptcode, medcode: "-9992DEL" });
                  }
              }
          }
      },
      MedTotalDelNull() {
          this.MedTotalData = this.MedTotalData.filter((item) => ((item.medresult != null && item.medresult != "") || (item.rad != null && item.rad != "") || (item.mic != null && item.mic != "")) && item.medcode != "-9992DEL");
          var datas = XE.clone(this.$refs.xTableMed.tableFullData, true);
          for (let i = 0; i < datas.length; i++) {
              let row = datas[i];
              if ((row.medresult == null || row.medresult == "") && (row.rad == null || row.rad == "") && (row.mic == null || row.mic == "")) this.MedGroupDel(row);
          }
      },
      selectchange(item, row) {
          // console.log("111",val);
          row.result_str = item.textvalue;
          row.result_flag = item.result_flag;
          this.$refs.xTableResult.clearActived();
      },
      querySearch(str, cb) {
          var results = this.tableDataResultAll;
          // 调用 callback 返回建议列表的数据
          if (this.Options.showrptitemvalbyfocus != "1") {
              results = [];
          }
          cb(results);
      },
      commentChange(val) {
          console.log(this.$refs.xTableResult);
      },
      MedTabClick(tab) {
          if (tab.name == 2) {
              if (this.commentnum == 4) {
                  this.commentnum = (this.$refs.xTableMed.parentHeight - 20) / 17;
              }
          }
      },
      ResultTabClick(tab) {
          if (tab.name == 2) {
              this.QuerySheet();
          } else if(tab.name == 3) {
              this.queryreportview();
          }
      },
      queryreportview(reportid) {
          this.reportviewstr = "";
          if (!reportid) {
              reportid = this.PatientInfo.reportid;
          }
          if (reportid && reportid != "no") {
              this.$tool
                  .request({
                      url: "ucent/print",
                      method: "post",
                      data: {
                          action: "reportprintview",
                          reportid: reportid,
                          env: "1"
                      }
                  })
                  .then(res => {
                      if (res.flag == "0") {
                          this.reportviewstr = res.msg;
                      } else {
                          this.reportviewstr = '<embed id="embed-report" width="100%" height="' + (document.getElementById("reportviewid").clientHeight - 32) + 'px"  name="plugin" src="' + res.pdfurl + '#toolbar=0" type="application/pdf" >';
                      }
                  })
                  .catch(e => {
                      this.$alert("预览报告出错！", "错误", {
                          confirmButtonText: "确定"
                      });
                  });
          }
      },
      QueryComment() {
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS311",
                  method: "post",
                  data: {
                      action: "querycomment",
                  },
              })
              .then((res) => {
                  if (!res.hasOwnProperty("errcode")) {
                      this.tableDataCommentAll = res;
                      this.tableDataComment = XE.clone(res, true);
                  }
              })
              .catch((error) => {
                  this.$message.error("错误:" + error);
              });
      },
      AdviceSubmit() {
          //this.tempRptItem.result_txt = this.advicetxt;
          var row = this.$refs.xTableResult.tableFullData.find((item) => item.rpt_itemcode == this.tempRptItem.rpt_itemcode);
          let index = this.$refs.xTableResult.tableFullData.indexOf(row);
          if (row) {
              this.$refs.xTableResult.tableFullData[index].result_txt = this.tempRptItem.result_txt;
          }
          this.dialogCommentVisible = false;
      },
      CommentSearch(value) {
          if (value) {
              this.tableDataComment = this.tableDataCommentAll.filter((item) => item.germcommentcode.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.germcommentname.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.descriptions.toUpperCase().indexOf(value.toUpperCase()) > -1);
          } else {
              this.tableDataComment = XE.clone(this.tableDataCommentAll, true);
          }
      },
      AdviceClick({ row }) {
          if (this.tempRptItem.result_txt) {
              if (this.tempRptItem.result_txt.indexOf(row.germcommentcode) == -1) {
                  if (this.appendChangeRow) {
                      this.tempRptItem.result_txt += "\n" + row.germcommentname;
                  } else {
                      if (this.tempRptItem.result_txt) {
                          this.tempRptItem.result_txt += "," + row.germcommentname;
                      } else {
                          this.tempRptItem.result_txt += row.germcommentname;
                      }
                  }
              }
          } else {
              this.tempRptItem.result_txt = row.germcommentname;
          }
      },
      AdvicedblClick({ row }) {
          this.tempRptItem.result_txt = row.germcommentname;
      },
      handleIconClick() {
          this.textvalueshow = !this.textvalueshow;
          // if (this.iconclass == "el-icon-arrow-down") {
          //     this.iconclass = "el-icon-arrow-up";
          //     this.textvalueshow = true;
          // } else {
          //     this.iconclass = "el-icon-arrow-down";
          //     this.textvalueshow = false;
          // }
      },
      ResultDblClick() {
          //this.QueryResultAll(row.rpt_itemcode, 0);
          this.textvalueshow = false;
          this.dialogResultVisible = true;
          if (this.tableDataResultS.length > 0) {
              this.$nextTick(() => {
                  this.$refs.xTableResultAll.setCurrentRow(this.$refs.xTableResultAll.getData(0));
              });
          }
      },
      ResultTextClick({ row }, rptrow) {
          rptrow.result_str = row.textvalue;
          rptrow.result_flag = row.result_flag;
          this.textvalueshow = false;
      },
      StrChange(row) {
          if (this.Options.modifyresultmsg == "2") {
              if (this.noupdateflag) {
                  var result = this.$refs.xTableResult.getUpdateRecords();
                  if (result.length == 0) return;
                  var index = result.find((item) => item.odata.rpt_itemcode == row.rpt_itemcode);
                  if (index) {
                      this.$confirm("是否修改当前项目结果", "提示", {
                          confirmButtonText: "确定",
                          cancelButtonText: "取消",
                          focusCancelButton: false,
                          type: "warning",
                      })
                          .then(() => {
                              this.noupdateflag = false;
                              this.CalcRef(row);
                          })
                          .catch(() => {
                              this.noupdateflag = false;
                              row.result_str = index.odata.result_str;
                          });
                  }
              }
          } else if (this.Options.modifyresultmsg == "3") {
              var result = this.$refs.xTableResult.getUpdateRecords();
              if (result.length == 0) return;
              var index = result.find((item) => item.odata.rpt_itemcode == row.rpt_itemcode);
              if (index) {
                  var olditem = this.tableDataResultOld.find((item) => item.rpt_itemcode == row.rpt_itemcode);
                  this.$confirm("是否修改当前项目结果", "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      type: "warning",
                  })
                      .then(() => {
                          this.CalcRef(row);
                          if (olditem) olditem.value = row.result_str;
                          else this.tableDataResultOld.push({ rpt_itemcode: row.rpt_itemcode, value: row.result_str });
                      })
                      .catch(() => {
                          if (olditem) row.result_str = olditem.value;
                          else row.result_str = index.odata.result_str;
                      });
              }
          } else {
              this.CalcRef(row);
          }
      },
      SheetChange() {
          this.sheetchangflag = true;
      },
      medmethodChange({ row, rowIndex }, val) {
          if(this.Options.etestmethodmodifymic && this.Options.etestmethodmodifymic=="1"){
              if (val.target.value == "KB") {
                  row.mic = "";
              } else if (val.target.value == "MIC" || val.target.value == "Etest") {
                  row.rad = "";
              }
          }else{
              if (val.target.value == "KB" || val.target.value == "Etest") {
                  row.mic = "";
              } else if (val.target.value == "MIC") {
                  row.rad = "";
              }
          }
          row.medmethod = val.target.value;
          this.MedCalc(row, rowIndex);
      },
      printGermSheet() {
          if (this.Options.germsheetid > 0) {
              if (this.PatientInfo && this.PatientInfo.reportid) {
                  this.$pub.printgermsheet(this, this.PatientInfo.reportid, this.Options.germsheetid, "1");
                  this.$emit("AfterPrint");
              }
          } else {
              this.$message.error("没有维护细菌流程单样式！");
          }
      },
      //培养基组合
      ShowGroup() {
          if (this.editflag) {
              this.groupVisible = true;
              this.xTable4List = this.getmediumgroupList;
              setTimeout(() => {
                  if (this.xTable4List.length > 0) {
                      this.$refs.xTable4.setCurrentRow(this.xTable4List[0]);
                  }
              }, 500);
          }
      },
      pureflagChange(e) {
          this.poppureflag = e;
          if (e != 4) {
              var arr = [];
              this.getmediumgroupList.filter((item) => {
                  if (Number(item.pureflag) == this.poppureflag) {
                      arr.push(item);
                  }
              });
              this.xTable4List = arr;
              if (arr.length > 0) {
                  this.$refs.xTable4.setCurrentRow(arr[0]);
              }
          } else {
              this.xTable4List = this.getmediumgroupList;
          }
      },
      savePure() {
          var mediumgroup = this.$refs.xTable4.getCurrentRow();
          this.Medium = "";
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS311",
                  method: "post",
                  data: {
                      action: "querymedium",
                      mediumgroupno: mediumgroup.mediumgroupno,
                  },
              })
              .then((res) => {
                  if (res && !res.hasOwnProperty("errcode")) {
                      var mediumstr = "";
                      for (let i = 0; i < res.length; i++) {
                          mediumstr += res[i].mediumname + ";";
                      }
                      this.Medium = mediumstr;
                      this.groupVisible = false;
                      this.sheetchangflag = true;
                  }
              })
              .catch((error) => {
                  this.$message.error("错误:" + error);
              });
      },
      getMediumGroup() {
          this.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "getmediumgroup",
                  },
              })
              .then((response) => {
                  // if(response.errcode == 1) {
                  if (response.length > 0) {
                      this.getmediumgroupList = response;
                  } else {
                      this.getmediumgroupList = [];
                  }
                  // }
              })
              .catch((e) => {});
      },
      groupCellDBLClickEvent({ row }) {
          this.savePure();
      },
      //点击行复查标志执行修改复查标志
      SaveNeedRechk(row, redoflag) {
          var result = [];
          var nowflag = row.redo_flag;
          row.redo_flag = redoflag;
          result.push(row);
          this.$tool
              .request({
                  url: "LIS/LIS3/LIS310",
                  method: "post",
                  data: {
                      action: "saveredoflag",
                      reportid: this.PatientInfo.reportid,
                      tablestr: result,
                  },
              })
              .then((res) => {
                  if (res.flag == "1") {
                      var indec = this.tableDataResult.findIndex((item) => item.rpt_itemcode == row.rpt_itemcode);
                      if (indec > -1) this.tableDataResult[indec].redo_flag = redoflag;
                      //this.$refs.xTableResult.loadData(this.tableDataResult);
                      this.PatientInfo.redo_flag = res.redo_flag;
                      this.$emit("PatChange", this.PatientInfo, "", "redo");
                  } else {
                      this.$alert(res.msg, "错误");
                      row.redo_flag = nowflag;
                  }
              });
      },
      getdatadictList(){
          let datadictList = [];
          if (this.Options.resdict && this.Options.resdict.length > 0) {
              this.Options.resdict.forEach(element => {
                  datadictList.push({
                      "data": element.rescode,
                      "display": element.resname,
                      "inputcode": element.rescode,
                  });
              });
          }
          this.resdatadictList=datadictList;
      },
      resistrulesChange(e, row) {
          let resdict = this.resdatadictList.find(item => item.data == e);
          row.result4 = e;
      },
      popMultipleChk(e, fieldname, option, title, type) {
          // BacCommon.popMultipleChk(this, e, fieldname, option, title);
          this.changeTablerow = type;
          let temp = JSON.parse(JSON.stringify(option));
          this.option1 = [];
          this.option2 = [];
          if (e) {
              let k = e.split(",");
              k.forEach((item) => {
                  let ndata = temp.find((m) => m.data == item);
                  if (ndata != undefined && ndata != null) {
                      this.option2.push(ndata);
                  }
              });
              temp.forEach((item) => {
                  if (k.indexOf(item.data + "") < 0) {
                      this.option1.push(item);
                  }
              });
          } else {
              this.option1 = temp;
          }
          this.fieldname = fieldname;
          this.multichktitle = title;
          this.dialogMultipleVisible = true;
      },
      closedialog(value, name) {
          if (value != "close") {
              let resdict = this.Options.resdict.find(item => item.rescode == value);
              if (this.changeTablerow == 1) {
                  let row = this.$refs.xTableResult.getCurrentRow();
                  row.result4 = value;
              }
          }
          this.dialogMultipleVisible = false;
      },
  },
  watch: {
      rptunitid(val) {
          this.myrptunitid = val;
      },
      MedTotalData(val) {
          console.log("ccc", val);
      },
      textvalueshow(val) {
          if (val) {
              this.iconclass = "el-icon-arrow-up";
          } else {
              this.iconclass = "el-icon-arrow-down";
          }
      },
      pOptions: {
          handler: function (val, oldVal) {
              this.Options = val;
              this.getdatadictList();
          },
          deep: true,
      },
  },
};
</script>

<style scoped>
/deep/.disabled-cell {
  background-color: #f7f7f7;
}
/deep/.warn-high {
  background-color: #ffc0c0;
}
/deep/.warn-low {
  background-color: #c0c0ff;
}
/deep/.danger {
  background-color: #ff0000;
}
/deep/.fontbold {
  font-weight: bold;
}
/deep/.paddingcolumn {
  padding: 0 3px;
}
/deep/.el-image {
  z-index: 2007;
}
/deep/.vxe-body--row .el-input--small .el-input__inner {
  height: 20px !important;
  line-height: 20px !important;
}
/deep/.middle-left .el-checkbox__input.is-checked + .el-checkbox__label {
  color: red;
}
/deep/.dialogdanger .el-textarea.is-disabled .el-textarea__inner {
  color: red;
}
::v-deep .autopart {
  overflow: hidden;
}
.pureflag-deal {
  display: flex;
  margin: 5px 0;
}
.mediumgroup-table {
  height: 300px;
}
.menu_style {
  position: absolute;
  width: 150px;
  background-color: #fff;
  border-radius: 2px;
  box-shadow: 2px 2px 14px #d0d0d0;
  z-index: 2008;
}
.menu_style > ul > li {
  text-indent: 25px;
  height: 38px;
  line-height: 38px;
  border-bottom: 1px dashed #f0f0f0;
  cursor: pointer;
}
.menu_style > ul > li:hover {
  background: #e0eeff;
}
.dangerPatInfo tr td:nth-child(even) {
  width: 40px;
  border-bottom: 1px solid black;
}

table tr td:nth-child(odd) {
  text-align: right;
  white-space: nowrap;
}
table tr td:nth-child(even) {
  text-align: left;
}
table tr td:nth-child(1) {
  width: 80px;
}
.SheetTable tr td:nth-child(1) {
  width: 50px;
}
.reqitem-dialog {
  position: absolute;
  z-index: 10000;
}
/deep/.vxe-table .vxe-cell {
  padding: 0;
}
/deep/.paddingcolumn .vxe-cell {
  padding: 0 3px;
}
/deep/ .bottom-table .vxe-table .vxe-table--empty-block {
  height: calc(100% - 34px);
}
.bottom-table-button {
  width: 100%;
  /* display: flex;
  justify-content: space-between; */
}
::v-deep .ResultGerm .el-tabs__content {
  top: 0px;
  position: relative !important;
  height: calc(100% - 25px);
}

::v-deep .ResultTxtTable.vxe-table .vxe-body--row td {
  background-color: #fff !important;
}
::v-deep .ResultTxtTable.vxe-table .vxe-body--row.row--hover td {
  background-color: #d7f1fd !important;
}
</style>
